DEV Community

Fabio Biondi
Fabio Biondi

Posted on

Redux is not DEAD!

WHY REDUX IS NOT DEAD even if every year you can read some articles or devs that say the opposite?

First of all I love #redux especially since "Redux Toolkit (RTK)" and RTK query has been released . It has been significantly simplified compared to the past.

Redux Toolkit offers several utilities to handle your store, actions, selectors, side effects and now (thank to Redux Toolkit Query) caching, prefetch, loading/error/pending states, pagination and more.

Redux is a library but also a pattern : you don't need to reinvent the wheel every time, and each developer of your team can easily understand what are you're doing and where to find stuff since it's opinionated.

📘 REDUX DEV TOOLS
There are many reasons why I love Redux but one of the most important is because it has amazing "Redux Dev Tools".
As you can see from the attached image you can keep everything under control and it is essential when your application grows and you have to manage complex states in relation to each other.
Furthermore it's also useful to understand the flow of your actions and how your application works.

Image description

Let's imagine a complex authentication process or complex views that involves a lot of steps, side effects and state updates: old and new team members can easily understand how your app works just opening Redux Dev Tools.

Anyway the main tabs of Redux Dev Tools is the most important and allow you to track anything:

1) what action is emitted and its payload
2) the current state and how it's updated after an action
3) what is changed from the previous state (thanks an useful DIFF panel)

But there is more:
➡️ Time Travel Debugging
➡️ Jump and Skip actions
➡️ save and load a JSON snapshots (imagine to have a bug: you can save a snapshot, send to anyone and re-create the scenario)
➡️ remote debugging
➡️ see the structure of your state by using the "chart graph"
➡️ and more...

Of course it's not simple as other micro state managers and you should not use it in any application or any case.
But there are scenarios in which this can be really useful.

😅 UNPOPULAR OPINIONS

1) Context is not a valid replacement of Redux.
2) I love Zustand, JOTAI, Valtio and other micro state managers. They are super easy to use and valid solutions for a lot of scenarios.
3) I know that some of these state managers partially support Redux Dev Tools but not completely because of different approaches.
4) We may write a state manager from scratch, or use Context or other state managers to create our own state manager but why reinvent the wheel?
Redux exists since the beginning, it's solid, tested, has a huge ecosystem, maintained and it's well know from a lot of devs

Latest comments (1)

Collapse
 
http400 profile image
PawelPawelPawel

I also love RTK but haven't used RTK query. Does it support request cancellation?