Answer the question
In order to leave comments, you need to log in
How to properly use state in React in conjunction with Redux?
Good day to all.
I've been familiar with React and Redux for quite some time now.
The essence of the question is this: as I understand it, according to the logic of Redux, we have one, common Store.
For example, I need to show/hide the popover of a button. Now I do it through this.state and this.setState - that is, I use the local state (I define the showPopover:true or false variable).
Is this approach correct, or is it necessary to act through the action reducer and change the global state?
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Through state and do it. Something that no other component of yours needs (which, in addition, are not children) fits perfectly in state.
Depends on the situation.
There was a component that depended on its own data - it used state.
But then it was necessary to add a second one so that they were synchronized - here I had to use the application store.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question