Things To Learn Before Redux

With React’s new context API you can go a long way with a plain old react app before things become tedious. I encourage you to learn how to use the new context API before you reach for redux.

I also have tremendous respect for component setState. Learn how to use it before you start with redux. Did you know setState takes a callback? Did you know you can pass setState an updater function? Did you know that you can declare state changes outside of a component?

Using Redux before you understand how to use higher order components can also be a little confusing. Before you start using redux understand higher order components well enough to know when it’s better to use a render prop.

If you’re comfortable with context, you’ve mastered setState batching and you know what a prop-namespace-clash is, and you are still finding you app hard to manage then you are going to love redux.

Redux doesn’t just give you access to any piece of state anywhere in your app, it also pushes you to rely on pure functions. This makes things a lot easier to test, and gets everyone on a team using the same approach.

Human Redux by Henrik Joreteg is the single the best book I have read on learning redux. Well worth the money. If you can’t afford it then google ‘Learn Redux with Dan Abramov’ for one of the best free resources for learning redux on the web.

Links:

 
1
Kudos
 
1
Kudos

Now read this

React Component Defaults

I’m giving up stateless functional components for a while. They’re super nice but they’re not worth the refactor when you need a lifecycle method. You could use recompose, which is also super nice, but completely avoidable. Sticking to... Continue →