Learn
Well done! In this lesson you:
- Learned the three promise lifecycle actions: pending, fulfilled, and rejected
- Learned how to use
createAsyncThunk
, which abstracts the process of handling promise lifecycle states according to best practices/common design paradigms - Imported
createAsyncThunk
from the Redux Toolkit:
import { createAsyncThunk } from '@reduxjs/toolkit';
- Refactored existing asynchronous action creators using
createAsyncThunk
. - Made your reducers respond to pending/fulfilled/rejected promise lifecycle actions by supplying the extraReducers property to
createSlice
.
Instructions
For comparison we’ve included the “old” way of doing things–manually handling the promise lifecycle actions–in oldAllRecipesSlice.js and the “new” way of doing things–with createAsyncThunk()
and the extraReducers
property in createSlice()
–in allRecipesSlice.js. Take a moment to review these two files and cement your understanding of the difference between them.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.