37 ms·
Redux is far from the suggestion, and imho unless you can greatly benefit from the actions boilerplate its overhead is not worth it. As others mentioned useImm
by xixixao 5y ago
Redux is far from the suggestion, and imho unless you can greatly benefit from the actions boilerplate its overhead is not worth it.
As others mentioned useImmer is a more bulletproof solution then assuming your state can always be modeled by a single layer Object though.
- bayesian_horse 5y agoI too felt like that for a long time. Eventually I got when and why Redux is useful, even with the boilerplate. Also, modern semantics and utilities greatly help. Redux Toolkit, RTK Query, reselect and so on. Actions make state more debuggable. Selectors make rendering more performant and often help structure complex rendering logic. Also, Redux is a way of not having to define asynchronous control flow by composing components, which can get really messy. Granted, it's not necessary for every app.
- handrous 5y agoI like Redux because it's portable—you can easily rip it out of a React project and use it anywhere—and because it provides a really nice way to separate backend-talking-stuff from frontend-rendering-stuff, if you're dividing up dev tasks. Nice clean place to split off a library for whatever service(s) you're consuming. And with Typescript, it's not a bit unpleasant to work with.
- 5e92cb50239222b 5y agoRedux Toolkit doesn't require much boilerplate anymore (IMHO). I found Redux to be absolutely appalling and never used it (despite having some familiarity with functional programming and the ideas underlying Redux) before RTK came along.
- acemarke 5y agoHeh, glad to hear that RTK is an improvement there :)