Learn

At this point, you can write a Redux app that uses redux-thunk—a middleware included in Redux toolkit—to permit asynchronous operations, such as fetching data from an API. In this lesson, we will explore some common patterns for managing asynchronous operations and the state changes they cause. We will learn about two Redux toolkit utilities—createAsyncThunk and the extraReducers option you can pass to the createSlice function—that simplify the process of performing asynchronous operations and reflecting their results in state.

This lesson uses Mock Service Worker to replicate the functionality of an external API. To use MSW, you’ll want to use Google Chrome and enable third-party cookies.

Instructions

Review the diagram shown. In Redux, middleware intercepts actions after dispatching and before passing them along to the reducer.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?