Redux Thunk

/θʌŋk/ · Noun · Development

Definitions

  1. A Redux middleware that allows action creators to return functions (thunks) instead of plain action objects, giving them access to dispatch and getState so they can perform asynchronous operations like API calls before dispatching the resulting action.

    In plain English: A simple add-on for Redux that lets you write actions containing async logic like network requests, instead of only plain data objects.

    Example: "The fetchUser thunk dispatches a loading action, awaits the API call, then dispatches the user data or an error."

Related Terms