At this point, we can write an app with Redux state management. But we haven’t covered one of the most common challenges in app development: making asynchronous requests. With a basic Redux store, we can only do synchronous updates. When an action is dispatched, it is immediately processed by a reducer, which updates the store accordingly. But when developing applications, we often want to perform asynchronous operations (such as making API calls) and update the state based on the results.
In this lesson, you will gain the tools necessary to write asynchronous logic that interacts with your Redux store.
- First, you will learn about two general concepts in computing: middleware and thunks, and the ways they relate to Redux.
- Next, you will learn about
redux-thunk, a middleware that uses a thunk-based approach to writing asynchronous actions.
- Finally, you will practice using
redux-thunkto add asynchronous functionality to your Redux apps.
You’ll notice our familiar recipe app has undergone some exciting changes. The structure of the app remains the same, but the app now contains more and richer data. In addition to titles, the recipes now have images attached. Refresh the browser, and note that this version also displays a loading state before the recipes are displayed.