Is anti-pattern to use component state in Redux?

I currently have my store settings. Various things trigger events to update the store, which updates the props downstream. This is very convenient when you run something to update in several components.

Is it an anti-pattern to use state for things that other components are not worried about?

I basically have a component that is a form page. Editing the form update status (i.e., selecting one parameter allows you to change other parameters). I draw, when the user clicks save, I will fire an event to store new data. Canceling a cancellation will result in a return to another page, so the return later will simply be re-populated from the state of the repository.

It makes sense?

+4
source share
1 answer

Using an internal state is fine (and recommended!) In simple behavior, like what you describe. Things like the state of modal (open / closed), flags, and other minor things that are perfectly observed are contained in the React state.

Remember that Redux is most useful when processing the global state of an application. When trying to decide where to save the state, try to answer the question "Will any other part of the application even care about changing this?" If so, use the Redux repository. Otherwise, execute the internal state.

+10
source

All Articles