Skip to main content

[ ![Redux Logo](/img/redux.svg) ![Redux Logo](/img/redux.svg) **Redux
Toolkit** ](/)

[ Getting Started ](/introduction/getting-started) [ Tutorials
](/tutorials/overview) [ Usage Guide ](/usage/usage-guide) [ API
](/api/configureStore) [ RTK Query ](/rtk-query/overview) [ GitHub
](https://github.com/reduxjs/redux-toolkit)

Search

  * [ Introduction ](/introduction/getting-started)

    * [ Getting Started ](/introduction/getting-started)
    * [ Why Redux Toolkit is How To Use Redux Today ](/introduction/why-rtk-is-redux-today)
  * [ Tutorials ](/tutorials/overview)

    * [ Tutorials Overview ](/tutorials/overview)
    * [ Quick Start ](/tutorials/quick-start)
    * [ TypeScript Quick Start ](/tutorials/typescript)
    * [ RTK Query Quick Start ](/tutorials/rtk-query)
  * [ Using Redux Toolkit ](/usage/migrating-to-modern-redux)

    * [ Migrations ](/usage/migrating-to-modern-redux)

    * [ Usage Guide ](/usage/usage-guide)
    * [ Usage With TypeScript ](/usage/usage-with-typescript)
    * [ Writing Reducers with Immer ](/usage/immer-reducers)
    * [ Setup with Next.js ](/usage/nextjs)
  * [ API Reference ](/api/configureStore)

    * [ Store Setup ](/api/configureStore)

      * [ configureStore ](/api/configureStore)
      * [ getDefaultMiddleware ](/api/getDefaultMiddleware)
      * [ Immutability Middleware ](/api/immutabilityMiddleware)
      * [ Serializability Middleware ](/api/serializabilityMiddleware)
      * [ Action Creator Middleware ](/api/actionCreatorMiddleware)
      * [ createListenerMiddleware ](/api/createListenerMiddleware)
      * [ createDynamicMiddleware ](/api/createDynamicMiddleware)
      * [ getDefaultEnhancers ](/api/getDefaultEnhancers)
      * [ autoBatchEnhancer ](/api/autoBatchEnhancer)
    * [ Reducers and Actions ](/api/createReducer)

      * [ createReducer ](/api/createReducer)
      * [ createAction ](/api/createAction)
      * [ createSlice ](/api/createSlice)
      * [ createAsyncThunk ](/api/createAsyncThunk)
      * [ createEntityAdapter ](/api/createEntityAdapter)
      * [ combineSlices ](/api/combineSlices)
    * [ Other ](/api/createSelector)

      * [ createSelector ](/api/createSelector)
      * [ Matching Utilities ](/api/matching-utilities)
      * [ Other Exports ](/api/other-exports)
      * [ Codemods ](/api/codemods)
      * [ Error Messages ](/errors)
  * [ RTK Query ](/rtk-query/overview)

    * [ RTK Query Overview ](/rtk-query/overview)
    * [ Comparison with Other Tools ](/rtk-query/comparison)
    * [ Examples ](/rtk-query/usage/examples)
    * [ Usage With TypeScript ](/rtk-query/usage-with-typescript)
    * [ Using RTK Query ](/rtk-query/usage/queries)

    * [ API Reference ](/rtk-query/api/createApi)

  * [ ](/)
  * API Reference 
  * Reducers and Actions 
  * createAsyncThunk 

On this page

#  ` createAsyncThunk `

##  Overview  ​

A function that accepts a Redux action type string and a callback function
that should return a promise. It generates promise lifecycle action types
based on the action type prefix that you pass in, and returns a thunk action
creator that will run the promise callback and dispatch the lifecycle actions
based on the returned promise.

This abstracts the standard recommended approach for handling async request
lifecycles.

It does not generate any reducer functions, since it does not know what data
you're fetching, how you want to track loading state, or how the data you
return needs to be processed. You should write your own reducer logic that
handles these actions, with whatever loading state and processing logic is
appropriate for your own app.

tip

Redux Toolkit's [ **RTK Query data fetching API** ](/rtk-query/overview) is a
purpose built data fetching and caching solution for Redux apps, and can
**eliminate the need to write _any_ thunks or reducers to manage data fetching
** . We encourage you to try it out and see if it can help simplify the data
fetching code in your own apps!

Sample usage: