Skip to Content
Learn
Managing Promise Lifecycle Actions
Conclusion

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.

Folder Icon

Take this course for free

Already have an account?