DEV Community

Discussion on: Do you need a State Management Library?

Collapse
 
victorocna profile image
Victor Ocnarescu

I use Redux in my React apps for one and only one purpose: to store in app memory the JWT when handling authentication (because saving it in local storage would be madness). And I chose Redux because it was very popular a few years ago.

I also use React Context to store app wide config info like theming, language. However I do not use any other "global" state, react-query is more than enough for displaying API results in the frontend.

Cheers!

Collapse
 
mjanuary profile image
MUHAWENIMANA Janvier

Use what makes you happy,
after all, you'll be the one debugging when anything goes wrong in your app

Collapse
 
bekbrace profile image
Bek Brace

Hey Victor, great post !

Collapse
 
mapleleaf profile image
MapleLeaf

It sounds like you don't need redux 🤔

Collapse
 
victorocna profile image
Victor Ocnarescu

That may be true, but what else? I need something non persistent to store some app state and I believe Redux is just that: a state container

Thread Thread
 
mapleleaf profile image
MapleLeaf

You can put it with the rest of your app state, or send it through another context provider.

Thread Thread
 
victorocna profile image
Victor Ocnarescu

Of course. But I wanted decoupled from my app state because I can reuse this principle for other apps that do not use React. It never actually happened until now but that's what I thought when I decided to use Redux: to keep things completely separated.