Questions tagged [react-state-management]
637 questions
2
votes
1 answer
How to manage React state for reusable radio input?
I have a reusable radio button that I'm using throughout my application - a form.
I want to store the form data in session storage so users can review their answers before submitting and because I will send the data to myself via EmailJS.
How should…
2
votes
1 answer
Updating the child component from parent component
I have an array in parent component with some values 'name', i want to render the items in the child component based on the matching value from an array with same value 'name'. Like when user clicks on an item from the parent component, it should…

Steven
- 231
- 1
- 8
2
votes
3 answers
Zustand get state from another Zustand store
*I have created 2 Zustand stores in react application, one is called UserStore, and the other is called SettingsStore, how can I get the state from UserStore to SettingsStore? *
import create from 'zustand';
const UserStore = (set, get) =>…

Mir Sisir
- 35
- 1
- 2
- 7
2
votes
4 answers
React Query devtools not showing
I am currently using react query in my project but the devtools Icon is not showing up anywhere on my screen. There are no errors in the console too. I am currently following a tutorial from youtube
Below is my package.json I have installed the…

Darshan Buddhacharya
- 21
- 1
- 3
2
votes
1 answer
How to make a stateful array with elements updating their own state individually in React?
import { useEffect, useState } from "react";
import { v4 as uuidv4 } from 'uuid';
interface Item {
id: string,
value: number
}
function App() {
const [list, setList] = useState- ([]);
useEffect(() => {
console.log(list);
},…

vendrick
- 478
- 1
- 5
- 12
2
votes
1 answer
How to return errors from Zustand Store
I'm using Zustand for a React Native project, and I'm not used to this setup. I have a store with some variables and functions, and I can't get Zustand to return error values for form entries.
Here is my store:
import create from 'zustand';
import…

Joel Hager
- 2,990
- 3
- 15
- 44
2
votes
3 answers
Unable to use zustand persist middleware
I'm working on a react-native app and I'm getting below warning after adding persistent middleware.
[zustand persist middleware] Unable to update item 'todos', the given storage is currently unavailable.
here is the code.
import {devtools,…

Hemendra Khatik
- 371
- 4
- 22
2
votes
2 answers
Updating a state in React leads to auto-updation of another state
I have two local states, UserList and ModifiedUsers in my App function. The UserList is supposed to capture an array of user objects from an API, and ModifiedUsers will operate on a copy of the array of objects to reverse/sort the list.
const APIURL…

Shree Nandan Das
- 75
- 9
2
votes
1 answer
Is it possible to expose a function defined within a React function component to be called in other components?
I'm refactoring some old code for an alert widget and am abstracting it into its own component that uses DOM portals and conditional rendering. I want to keep as much of the work inside of this component as I possibly can, so ideally I'd love to be…

Zach Kaigler
- 279
- 5
- 15
2
votes
0 answers
React state returning NULL on submit, despite logging non-NULL value
The intended functionality is as follows:
Select an item in the list by pressing (calls onPressSport())
The item's value is stored in the sport state
When the next button is pressed, onPressNext() is called (which calls a function from…

Griffin Foster
- 21
- 2
2
votes
0 answers
React Native Animation re runs after state change
How to stop react animation from reanimating after the state has changed?
I have a textInput inside an Animated.View, upon OnChangeText, the animation reruns.
This is the code for the animated view, it rolls down a view from the top of the screen…

Sahand Shahriari
- 56
- 8
2
votes
2 answers
Why does a custom hook that uses another hooks value via useContext only shows its initial value?
I'm trying to reuse a bunch of custom hooks without re-invoking them and without maintaining an order through which I'll have to pass cascading parameters from one hook to the other.
A working example:…

silicakes
- 6,364
- 3
- 28
- 39
2
votes
2 answers
Intermediate component logic only being applied once React
Here I am passing state up via props through an intermediary component. The intermediate component has a handler (onIntermediatePropsHandler) has some logic
(const formatedAmount = enteredAmount += 10;)
that executes on the data being passed. It…

Byron
- 75
- 9
2
votes
2 answers
How to pass variable between screens in react native (see attached)
Please see snapshot attached: Code Snippet
I'm trying to export this variable "email" from the 'List' screen, to the 'Account' screen without having to navigate to it as it is a bottomTabNavigator.
Any help would be very appreciated!
Here's the…

federico-pi
- 23
- 5
2
votes
1 answer
Showing/hiding React components does not maintain internal state
I am trying to hide/show components in React based on some state. The main issue I am facing is to maintain the internal state of the components during hiding and showing. The below is the code that does what I expect and maintains the state of each…

craig-nerd
- 718
- 1
- 12
- 32