DEV Community

Discussion on: Managing State in React: Redux or not Redux?

Collapse
whoisryosuke profile image
Ryosuke

You did a great job documenting the difference, solid code examples. I literally went on this journey myself just last week trying to figure out the best boilerplate for a React app that needs authentication 🔐 My goal was to start with the Context API and only use Redux if I really needed it -- and I never really needed Redux. 😇

Once you wrap your head around the Context API, updating/modifying the Providers, and persisting state inside the Provider to local or session storage -- it's hard to think of a situation where you'd need Redux if you can nest your components properly.

It's cool to see the use of it in a lot of libraries, like Material UI, to create a "theme" provider that creates a global theming config you can use with any theme consumer. It allows for greater flexibility natively through React, without weighing down a lib with deps 🏋️‍♀️