I don’t like the structure Redux forces my apps into. This might be a good opportunity to see what simple solutions people are using to avoid stuff like Redux. I remember reading about this: https://hookstate.js.org/
Redux – Not Dead Yet (2018)
51–60 of 133 posts
Re: Redux – Not Dead Yet (2018)
#52IMO the biggest and best draw of Redux is how it allows you to completely separate your business logic from your UI layers. Your components only know about props and state and are rather trivial to test. Hooks are great for re-usable logic as well but my team made the choice to have hooks deal only with localized state concerns and have a robust Actions => Services => Reducer layer for everything that speaks to things outside that constraint. Its worked out wonderfully so far. Tests are a breeze and logic is highly portable. Our UI layer is thin and easy to change.
Its not all roses of course. The Redux store can turn into a rats nest of keys and values with no obvious structure (or worse, duplicated structures). It's something that requires actually sitting down and modelling out your data structures. Sadly that's something I don't see very often (and I am just as guilty as anyone else). The Redux team came up with some good guidelines on this point (too lazy to track the link down but its on the main site) and I think they have some really good ideas. I think more than anything its important to consider your store in the same manner you would a database and approach it with that kind of mindset. As with all things JS, its easy to dive in, hard to untangle yourself! :)
Re: Redux – Not Dead Yet (2018)
#53I've recently tried using Redux for a side-project. While it solves the problem (organizing state), I feel there is too much boilerplate for my small project. Are there any popular alternatives which don't use reducers? EDIT: thanks for all the responses, I'll check them out :)
Super simple, 100% test coverage, 100% typesafe if using typescript, absolutely no boilerplate.
Re: Redux – Not Dead Yet (2018)
#54One underrated thing that I miss from using Redux is the "action trace". You can literally sit down with the stakeholders [1] and explain the exact things that caused a screen to render . And these things are not cryptic function calls with stack-traces, but simple and chronologically ordered sets of human readable "actions" (I like to think of them as events) like UserFetched -> PlanFetched ( ) -> FrozenUser. One ca…
Overrated. In what kind of application do you need this? In the vast majority of React apps you do not need this.
Re: Redux – Not Dead Yet (2018)
#55Reading through the comments it sounds like it's struggling, even positing the question sews doubt. I thought redux was still one of the 'must have' tools for building react apps now.
What has everyone been migrating to? Is there a consensus successor to Redux?
Re: Redux – Not Dead Yet (2018)
#56One underrated thing that I miss from using Redux is the "action trace". You can literally sit down with the stakeholders [1] and explain the exact things that caused a screen to render . And these things are not cryptic function calls with stack-traces, but simple and chronologically ordered sets of human readable "actions" (I like to think of them as events) like UserFetched -> PlanFetched ( ) -> FrozenUser. One ca…
Overrated. In what kind of application do you need this? In the vast majority of React apps you do not need this.
Re: Redux – Not Dead Yet (2018)
#57I think it's even more important for people self-learning react to be exposed to redux in some way; yeah, there's boilerplate, but it's just beautiful when all put together and isn't a Blackbox (I love dan's tutorial on egghead explaining redux from the ground up precisely because it breaks down exactly what's working and why it is).
This blog post does an excellent job of convincing newcomers in the JS world to consider learning redux. I'm definitely forwarding this to the current instructor of the course!
Re: Redux – Not Dead Yet (2018)
#58> Is Redux dead, dying, deprecated, or about to be replaced? No. Reading through the comments it sounds like it's struggling, even positing the question sews doubt. I thought redux was still one of the 'must have' tools for building react apps now. What has everyone been migrating to? Is there a consensus successor to Redux?
Re: Redux – Not Dead Yet (2018)
#59Re: Redux – Not Dead Yet (2018)
#60Earlier quoted context omitted.
Can you give me an example how you got to 400 actions? Just enumerate like 5 or so, I’m assuming you are building features where groups of actions are just necessary based on the patterns you are using. I’m genuinely curious because I feel like this kind of inflation of actions/reducers in Redux is what makes it nightmarish.
For one thing they do encourage a lot of tiny actions. A frequent pattern I use requires three actions for every server call: one to trigger a saga, one when it succeeds, and one for when it fails. The standard form is incredibly verbose, I've started to shift away from it.
[0] https://redux-toolkit.js.org/api/createAsyncThunk
[1] https://blog.isquaredsoftware.com/2020/02/blogged-answers-wh...