Live data from Hacker News

Redux – Not Dead Yet (2018)

blog.isquaredsoftware.com

11–20 of 133 posts

Re: Redux – Not Dead Yet (2018)

#11
post #2

Oh hey, that's my post. I first wrote it back in 2018, and just updated it yesterday with some additional links and comparisons. (Actually was considering retitling it after getting some feedback last night, but given that the link just got submitted here, I'll leave it as-is for now.) A few quick notes: - If you haven't looked at Redux in a while, please try out our official Redux Toolkit package [0], which is now o…

That was a great article—wish I had read it back in 2018! I'll chime in with some thoughts, as someone who has built several apps using React/Redux.

What's happened with me (and others I've seen) has been discovering Redux, falling in love, and thinking "I'll use it for everything!" There's something about the simplicity of having a single state tree, that is immutable and debuggable that just blows your mind.

Then you start building, and after writing your Xth action/reducer/selector/dispatch/etc, you tire of the boilerplate and the overhead.

So where I've landed is: 1) we use Apollo/GraphQL for data-fetching and caching. 2) we use hooks in general. 3) for deeply nested component communication, we haven't fully settled on whether to use redux or not and kind of mix it up depending on the circumstance 4) we use redux when we need app-wide state and/or debuggability (so everything that's not 1, 2, or 3).

This has worked pretty well for us, though (3) is still a little fuzzy.

Anyway, I do think Redux is awesome, so thanks for maintaining it. But just wanted to chime in that I think a lot of "Redux is dead" sentiment (besides just being article click-bait and sensationalism by publishers) is actually people realizing that they've done the "everything is a nail" thing and retreating a little bit from that.

Re: Redux – Not Dead Yet (2018)

#12
post #2

Oh hey, that's my post. I first wrote it back in 2018, and just updated it yesterday with some additional links and comparisons. (Actually was considering retitling it after getting some feedback last night, but given that the link just got submitted here, I'll leave it as-is for now.) A few quick notes: - If you haven't looked at Redux in a while, please try out our official Redux Toolkit package [0], which is now o…

I’ve been loving redux toolkit so far, so great job on that! The docs are super good too, so props for wanting to improve them further.

I encourage everyone to try out redux toolkit if you feel like redux is too much boilerplate. It also comes with immer out of the box, so no more crazy spread operators.

Re: Redux – Not Dead Yet (2018)

#13
Redux is great, and I'm glad to see all this cleared up, to some extent. Especially the bit about the new context API somehow eliminating the need for Redux. I know some people don't like redux and that's fine - don't use it. But it's still super-useful to many, many people.

Re: Redux – Not Dead Yet (2018)

#14
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 :)

There are some which require less boilerplate and actually are (partially significantly) smaller in size.

https://github.com/jamiebuilds/unstated https://github.com/dai-shi/react-tracked https://github.com/react-spring/zustand https://github.com/diegohaz/constate

(there are more, but these may be among the most popular)

You can find a comparison (and more) here: https://github.com/dai-shi/lets-compare-global-state-with-re...

Re: Redux – Not Dead Yet (2018)

#15

I really think it should die, from a DDD perspective EDA should be handled as backend tasks with CQRS. If your api server isn't handling that then you really should stand up a BFF. I get that Redux is designed to handle all of that on the front end but it just doesn't belong there. I have seen too many projects devolve into garbage because they are trying to shoehorn too much crap into reducer patterns when it just d…

How do you update the front-end state after the backend task is complete other than reload the whole page?

Re: Redux – Not Dead Yet (2018)

#16
post #7
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 :)

There's stuff like MobX, but much of the point of Redux is the reducer step. You may be happy with just using hooks, though.

Do you mean the point of Redux?

Re: Redux – Not Dead Yet (2018)

#17
post #2

Oh hey, that's my post. I first wrote it back in 2018, and just updated it yesterday with some additional links and comparisons. (Actually was considering retitling it after getting some feedback last night, but given that the link just got submitted here, I'll leave it as-is for now.) A few quick notes: - If you haven't looked at Redux in a while, please try out our official Redux Toolkit package [0], which is now o…

Do you, or anyone else in the team or community, have a good resource you would recommend to people complaining about "too much boilerplate" in redux code? It is likely the most common complaint I see, that I understand to come from a place of people not understanding it this a tool best used for scaling and/or already big projects. Whenever I have worked with Redux in a large project, that "boilerplate" is minimal and the benefits obvious.

Re: Redux – Not Dead Yet (2018)

#18
I found I was just using Redux as a data caching layer and ended up using SWR hooks instead https://swr.now.sh/. This has resulted in way less boilerplate (which increases even more with a type system) and a better development and user experience for the product I was working on. For everything else I use context like managing modals, auth, errors, and firebase connections.

Re: Redux – Not Dead Yet (2018)

#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 can rewind the actions and iterate with the stakeholders why that screen appeared. This is huge and I miss this a lot.

1. Note that most of the time the stakeholder is yourself and/or another developer. But can also definitely be a non-coder.

Post reply on HN