Skip to content
loading...

What is the future of Redux?

twitter logo github logo ・1 min read  

Redux is the reason why I started using React in my projects. Having a global state that is updated by a series of actions and a view that is updated deterministically from the state makes development and, specially debugging, extremely pleasurable.

Redux Devtools is also an extremely powerful tool that has no equal in any other JS framework.

On the other hand, I have the feeling that Redux is falling out of grace lately and the tendence is going back to stateful components.

Does Redux still have some place in the hearts of the React community?

twitter logo DISCUSS (2)
markdown guide
 

I don't think Redux is going anywhere anytime soon. It proved to be a great companion for React, providing ways to manage the application state, with React being completely decoupled from it. This way you can use React just for the view side of things (as it was intended) and manage the app with Redux. For example, in almost all projects at my company we can use Redux portion of the app without ever touching React. This I think is a very big benefit for developer experience, because it kind of keeps the project clean and hygienic.

That said, after using Redux for a while, with Redux-Saga and TypeScript, I think that I would be a little more satisfied with less boilerplate code. There is a ton of work to add a new state tree to the root state, if you want to keep things clean. That bugs me and it can get really frustrating sometimes.

About going back to stateful components, I don't think that is ever going to happen. React component state was never really meant to contain the app state, even though it can be used that way. I use component state only for the things that don't change the state of the app, for example if there is a pop up modal open, or if the navbar is expanded, things that are tied only to the React component.

I really see React as only the view part of my application, providing a very convenient way to write UIs. They are after all "a function of props and state", a way to represent the data which you provide to them.

 

Thank you for your answer.

We use Redux with Redux Thunk, Axios Middleware and a couple of custom middlewares we developed. We also use Reselect a lot.

As for the local state, we have a kind of rule: components in the design system do not know anything about Redux and have local state if needed. The components that are specific to our App are connected to Redux and pass the props and action creators to the design system components.

As for boilerplate, it really does not bother me. At the end, writing a new reducer takes me 3 minutes, and it's not something I do all the time. :)

Classic DEV Post from Sep 9 '19

What I learned after applying to 100 jobs

Between August 2014 and July 2019 I applied for just over 100 jobs. Like most people, I find job hu...

Daniel profile image