DEV Community

Explain Redux like I'm 5!

Brittney Postma on April 24, 2020

TLDR: Redux is a state management library that you can add to projects to help keep it organized. Here's some links: Redux.js.org, github repo, or ...
Collapse
 
markerikson profile image
Mark Erikson

Hi, I'm a Redux maintainer. Please check out our new official Redux Toolkit package. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once:

redux-toolkit.js.org

Also, while connect still works fine, we're now recommending that folks use our React-Redux hooks API as the default.

Collapse
 
brittneypostma profile image
Brittney Postma

Thank you, I'm going to try and convert it over and will update the article!

Collapse
 
brittneypostma profile image
Brittney Postma

I updated the article and the app if you wanted to take a second look. Thank you for your input!

Collapse
 
omawhite profile image
Omar White

Hey Mark, can you elaborate on why you’re recommending the react-redux hooks as the default. What are the pro’s of that approach as opposed to wrapping components in connect.

Collapse
 
markerikson profile image
Mark Erikson

connect still works fine, and we're going to continue maintaining and supporting it indefinitely.

But, useSelector and useDispatch are shorter and easier to work with in many cases, and they definitely work better with TypeScript. There's less indirection, less code, and it's more obvious what's happening.

Hooks in general (and especially React-Redux hooks) do bring up a different set of tradeoffs, which I talked about in my post Thoughts on React Hooks, Redux, and Separation of Concerns and my ReactBoston 2019 talk on "Hooks, HOCs, and Tradeoffs". I'd encourage you to go through those.

Thread Thread
 
omawhite profile image
Omar White

Thanks for the links, that’s exactly what I was looking for. My team and I have been trying to understand the trade offs.

Collapse
 
abahari profile image
Aissam BAHARI

Great Writing, it will be better to use react Hooks react-redux.js.org/api/hooks to avoid using connect ...

Collapse
 
brittneypostma profile image
Brittney Postma

Thank you, I'm going to try and convert it over and will update the article!

Collapse
 
brittneypostma profile image
Brittney Postma

I updated the article and the app if you wanted to take a second look. Thank you for your input!

Collapse
 
sharmakushal profile image
Kushal sharma

Awesome post buddy. It helps me to clear mine some doubts regarding redux

Collapse
 
brittneypostma profile image
Brittney Postma

Thank you so much, glad it helped.

Collapse
 
lewismcampbell profile image
Lewis Campbell

Great write up, helped with my understanding of it. I know it's something I need to implement at some point properly