Live data from Hacker News

Redux – Not Dead Yet (2018)

blog.isquaredsoftware.com

51–60 of 133 posts

Re: Redux – Not Dead Yet (2018)

#52
I love Redux but I am very frugal about what I put into the store and have come up with a strong set of design patterns with my team to know what should and should not go there. That, in conjunction with hooks for any other stateful concerns we have, makes for a sane and pleasant dev experience.

IMO 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)

#53
post #3

I'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 :)

Try mine! https://github.com/gunn/pure-store

Super simple, 100% test coverage, 100% typesafe if using typescript, absolutely no boilerplate.

Re: Redux – Not Dead Yet (2018)

#54
post #25
post #20

One 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.

I concur. I used React for a year or so I never used this feature once. I was too busy writing all the necessary boilerplate.

Re: Redux – Not Dead Yet (2018)

#55
> 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)

#56
post #25
post #20

One 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.

any application that you need to debug, I have not ran into a application React or not that I didn't need to debug and Redux does help with debugging greatly.

Re: Redux – Not Dead Yet (2018)

#57
I taught a course on Javascript in undergrad with a unit on react as well as redux (cis.upenn.edu/~cis197, check it out!). To this day, I still think people learning JS should know about redux because of the design pattern it encourages (note that when people are first learning CS, this is probably the first-ish time they're coming across the concept of a reducer and "functional" state that isn't mutated directly).

I 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?

Nothing. The latest version of React has plenty of features now (such as hooks) that take the wind out of Redux’s sails.

Re: Redux – Not Dead Yet (2018)

#59
I've used redux many times and the amount of boilerplate code is large. What Redux does is cool, but it complicates the app and is a pain to update. I feel this is going to go the way of Java Enterprise Beans as React continues to mature.

Re: Redux – Not Dead Yet (2018)

#60
post #45

Earlier 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.

Note that the new `createAsyncThunk` API in Redux Toolkit handles generating and dispatching the promise lifecycle actions for you [0]. Also, while sagas are a great power tool, most Redux apps don't need them [1].

[0] https://redux-toolkit.js.org/api/createAsyncThunk

[1] https://blog.isquaredsoftware.com/2020/02/blogged-answers-wh...

Post reply on HN