by sheerun on 10/22/22, 2:16 PM with 6 comments
I wonder if there exist now better alternatives? What do you recommend?
by matthewwolfe on 10/23/22, 2:19 AM
by solardev on 10/22/22, 4:06 PM
You can wrap your whole app in a context provider, and/or combine it with state trees that only certain features or components or users need. Then any child within any tree can pull from the contexts.
It's up to you whether you want to use a reducer like pattern, or make the setter itself available in the context so any consumer can mutate state, or pass along a helper function that sets state as an abstraction.
Any way you do it, it will be far easier to use than the nightmare that is Redux. It might be more disorganized, with a lot of separate state hooks, but each one can be relatively modular. Overall I found it waaaaaay easier than Redux.
by rtcoms on 10/22/22, 5:34 PM