Live data from Hacker News

Redux – Not Dead Yet (2018)

blog.isquaredsoftware.com

61–70 of 133 posts

Re: Redux – Not Dead Yet (2018)

#61

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

It depends on your use case, but he mentions some alternative solutions in the article.

1) React's Context API

It's straightforward to use, and it solves the issue of passing data to deeply nested components, but that's all it does.

2) GraphQL Apollo Client

I used this on a recent project for managing client-side state, and to me, it felt like I had to do a lot of work to achieve what should be basic functionality. It was my first foray with Apollo Client, so take my opinion with a grain of salt, but I found myself wishing I was using Redux instead for the duration of the project. Also, Apollo Client has some bugs related to cache invalidation (look on Github). These may be solved now, but they bit me pretty hard.

3) The new React "Hooks" API

Looks nice. Have not used it.

Re: Redux – Not Dead Yet (2018)

#62
post #48

I don't like how this article moves the goal posts of whether redux fits our use case or not. It has some valid arguments (dev tools) but the overhead of the boilerplate and tooling around redux is just not worth it IMO. Much better to break your app state into various custom hooks that leverage Context API and the `useReducer` hook.

Not sure what you mean by "moving the goalposts" here.

I'm trying to make a few specific points:

- Redux is not "dead" in the sense that it is still widely used and is continuing to be adopted

- There are definitely many other tools in the React ecosystem that overlap with how you'd use Redux, but the Venn diagrams for the use cases don't entirely match up, and the other solutions don't necessarily have all the capabilities of Redux

- Redux _has_ been over-used and put in apps where it didn't fit well, and I want people to only use it when it makes sense to do so

- Our Redux Toolkit library and React-Redux hooks API make it a lot easier to use Redux

Re: Redux – Not Dead Yet (2018)

#63

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

That would be the "Style Guide" docs page:

https://redux.js.org/style-guide/style-guide

Re: Redux – Not Dead Yet (2018)

#64
i propose updating the title to include something about this being (revised 04-2020) or [updated]

i’ve been wondering the state of things as im jumping back into react projects after a couple years off.

Re: Redux – Not Dead Yet (2018)

#65
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…

I was about to ask what kind of stakeholder gives a damn about sitting down with you and going through an action trace to see why a certain screen rendered, but I’m glad you added the note at the bottom.

Regardless, yourself or another developer as the “stakeholder” in this scenario is a bit of a cop out. In the real world stakeholders aren’t technically inclined and even if they are they don’t care about this minutiae.

Re: Redux – Not Dead Yet (2018)

#66

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

That's literally the point I'm making in the article.

There's a huge difference between all the chatter on social media, and the actual stats reflecting Redux's usage.

Two charts to illustrate this:

First, overall downloads for React, Redux, React-Redux, MobX, and Apollo Client over the last two years:

https://npm-stat.com/charts.html?package=react&package=redux...

You can see that net Redux usage overall has continued to increase, and is holding fairly steady at about 50% of React downloads.

Second, for Redux Toolkit specifically, the growth rate from just before we released `redux-starter-kit@1.0`, then renamed it to `@reduxjs/toolkit@1.0.4`, through today:

https://npm-stat.com/charts.html?package=%40reduxjs%2Ftoolki...

Obviously way fewer total downloads, but that's a steadily increasing growth rate for RTK.

This is not something that's "struggling". There's just a lot of FUD thrown around on social media that makes it sound that way.

Re: Redux – Not Dead Yet (2018)

#68
Redux always had to much boilerplate for me to prefer it.

The last couple years I have been using the new Context API and spliting my app state out by creating a global context, and many domain specific contexts where the context contains both the data and functions used to work with that data. Typescript + state with data and functions created a great api per domain. I found this approach just as clean but with less boilerplate.

Though redux does have some performance and tooling benefits.

Re: Redux – Not Dead Yet (2018)

#69
post #50

Earlier quoted context omitted.

It's worth noting that the Redux DevTools Extension _can_ capture and display a literal stack trace for every dispatched action, if you've enabled that while setting up your store. This allows you to see what part of your app triggered each state update: https://github.com/zalmoxisus/redux-devtools-extension/blob/...

I always see you in these Redux threads and you are always so helpful, thank you!

The posted article is actually acemarke's

https://news.ycombinator.com/item?id=22822655

Re: Redux – Not Dead Yet (2018)

#70

The most overrated tool I've ever had to misfortune of having to wrangle. Talk about bloat and lasagna code. I've used mobx and it's better. Now I use apollo, and it's even better. Just thinking about having to use redux and sagas and all that bloat makes my stress levels rise. I can't believe it became as big as it did. "muh time travel" is a meme of epic proportions.

Amazing how many downvotes all the redux critical posts get. Redux is indeed horrible and leads to all sorts of bloat and bugs.
Post reply on HN