Adding Redux-thunk
Learn how to add redux-thunk to your project.
We'll cover the following
The real power of actions comes with the use of various middleware. One of the most common and useful ones for learning Redux is redux-thunk. In contrast to what we’ve said before, actions passed to dispatch()
don’t need to be objects. Reducers are the only part of Redux that requires actions to be objects. Using middleware, we can transform non-object actions into objects before they reach the reducers.
Using redux-thunk
, we can create asynchronous action creators with access to both the Redux state and the dispatch()
function.
Get hands-on with 1400+ tech skills courses.