How to create local state? #2112
-
I only able to create global states with redux, called slices and reducers that are exported as a global store. I have tried to do the same thing as I do when declaring the global state - however when I ran the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
We specifically recommend using normal React component state wherever it makes sense (like just that component or its immediate descendants needing that data): |
Beta Was this translation helpful? Give feedback.
-
BTW in the action we have the
Will not make a use with the type. But type is included on every call to every reducer, why? |
Beta Was this translation helpful? Give feedback.
Yeah, Redux is by nature a global state solution.
It's worth noting though that if you're a particular fan of the slice pattern, it's possible to use reducers and action creators made with createSlice in combination with useReducer.