For redux itself, you can only dispatch action which is a plain JS object(or an action creator returns an action, this action is a plain JS object must have a type field.). But with various middlewares, you can dispatch various things such as a thunk, plain JS object action, etc. The middleware will transform the action to plain JS object action in the end.

When using the redux-thunk middleware, you can dispatch a thunk like this:

const thunkFunction = (dispatch, getState) => {
  // logic here that can dispatch actions or read state
}

store.dispatch(thunkFunction)

The login thunk action creator does return a thunk.

A thunk action creator is a function that may have some arguments, and returns a new thunk function. See Writing Thunks

Another example, redux-promise-middleware,

Given a single action with an async payload, the middleware transforms the action to separate pending action and a separate fulfilled/rejected action, representing the states of the async action.

You can dispatch an action with async payload:

const response = dispatch({
    type: 'FIRST',
    payload: new Promise(...),
});
Answer from Lin Du on Stack Overflow
🌐
React Redux
react-redux.js.org › hooks
Hooks | React Redux
February 11, 2026 - However, if you'd like to still use this hook yourself, here's a copy-pastable version that supports passing in action creators as a single function, an array, or an object. import { bindActionCreators } from 'redux' import { useDispatch } from 'react-redux' import { useMemo } from 'react' export function useActions(actions, deps) { const dispatch = useDispatch() return useMemo( () => { if (Array.isArray(actions)) { return actions.map((a) => bindActionCreators(a, dispatch)) } return bindActionCreators(actions, dispatch) }, deps ?
People also ask

What are some alternatives to useDispatch?
While useDispatch is the recommended approach for modern React Redux applications, older versions used the connect function from react-redux. This function allows you to map specific parts of the state and actions to the component's props.
🌐
dhiwise.com
dhiwise.com › post › react-usedispatch-hook-explained-optimizing-component-performance
React useDispatch Hook and Beyond: Optimize React-Redux Performance
How can I improve performance with useDispatch?
You can improve performance with useDispatch by: - Using useSelector to access specific parts of the state instead of the entire state tree. - Memoizing action creators using libraries like reselect or memoize-one. - Wrapping components with React.memo for conditional rendering based on specific state changes. - Utilizing middleware like Redux Thunk or Redux Saga for handling complex asynchronous actions outside of components.
🌐
dhiwise.com
dhiwise.com › post › react-usedispatch-hook-explained-optimizing-component-performance
React useDispatch Hook and Beyond: Optimize React-Redux Performance
What is selective dispatching?
Selective dispatching is a practice in React Redux where you only dispatch actions that are directly relevant to the specific component and its functionality. This helps avoid unnecessary re-renders and improves performance.
🌐
dhiwise.com
dhiwise.com › post › react-usedispatch-hook-explained-optimizing-component-performance
React useDispatch Hook and Beyond: Optimize React-Redux Performance
🌐
Medium
medium.com › @mendes.develop › introduction-on-react-redux-using-hooks-useselector-usedispatch-ef843f1c2561
Introduction on React-Redux using Hooks ( useSelector & useDispatch ) | by Alex Mendes | Medium
November 25, 2019 - Let’s start by importing useSelector from the react-redux library. useSelector is a function that takes the current state as an argument and returns whatever data you want from it.
🌐
Scaler
scaler.com › home › topics › react › hooks in redux : useselector and usedispatch
Hooks in Redux useSelector and useDispatch - Scaler Topics
June 22, 2024 - ... However, we have not changed ... useDispatch is yet another hook in redux which is equivalent to the mapDispatchToProps argument in the connect() higher-order function....
🌐
GeeksforGeeks
geeksforgeeks.org › reactjs › react-redux-hooks-useselector-and-usedispatch
React Redux Hooks: useSelector and useDispatch. - GeeksforGeeks
July 23, 2025 - Import the useDispatch hook from the 'react-redux' library. ... Call useDispatch within your functional component to get a reference to the dispatch function. ... Use the dispatch function to dispatch actions to the Redux store, which will update ...
Find elsewhere
🌐
egghead.io
egghead.io › lessons › react-dispatch-actions-with-the-usedispatch-hook-in-redux
Dispatch Actions with the useDispatch Hook in Redux | egghead.io
As I type in new amounts, the selector recognizes them, and our exchangeRate component is updated immediately. [2:25] We've gotten rid of handleAmountChange. Let's go ahead and take care of handleCurrencyCode. Open up currency code picker. We'll also import useDispatch, const dispatch = useDispatch().
Published   January 4, 2021
🌐
ScriptVerse
scriptverse.academy › tutorials › reactjs-useselector-usedispatch.html
React Redux w/with Hooks: How to use useSelector(), useDispatch()
// index.js import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import store from './store'; import SelectAndDispatch from './selectAndDispatch'; ReactDOM.render( <Provider store={store}> <SelectAndDispatch/> </Provider> document.getElementById('root') ); ... We have made use of the useSelector() and the useDispatch() hooks, without the use of connect() and the associated mapStateToProps() and mapDispatchToProps() functions.
🌐
DhiWise
dhiwise.com › post › react-usedispatch-hook-explained-optimizing-component-performance
React useDispatch Hook and Beyond: Optimize React-Redux Performance
September 5, 2024 - It allows for a cleaner and more ... optimization, let's understand what useDispatch does. It's a React hook that provides access to the Redux store's dispatch function....
🌐
Memberstack
memberstack.com › home › blog › product › using react redux hooks: useselector() and usedispatch()
Using React Redux Hooks: useSelector() and useDispatch() | Memberstack
June 3, 2022 - React Redux useSelector is a custom hook introduced in React Redux v7.1.0. Combined with other custom hooks such as useDispatch, it enables developers to manage state in Redux while writing fast, performant, and easy-to-read code in as few lines as possible. In this article, you will explore useSele
🌐
GitHub
github.com › reduxjs › react-redux › discussions › 1789
What's the advantage of useDispatch over store.dispatch? · reduxjs/react-redux · Discussion #1789
There's no "stateful thing" involved with useDispatch. As you can see here, the hook implementation is trivial - it's literally just returning store.dispatch. The important thing is that the store is being dependency-injected via context at runtime: https://github.com/reduxjs/react-redux/blob/v7.2.4/src/hooks/useDispatch.js#L14-L17
Author   reduxjs
🌐
Alma Better
almabetter.com › bytes › tutorials › reactjs › hooks-in-redux
React Redux Hooks: useSelector and useDispatch
October 18, 2023 - The main benefit of using **useDispatch** is that it provides a clean and simple way to dispatch actions from React components. It eliminates the need to pass the **dispatch** function down through props, which can be cumbersome and difficult to manage in larger applications.
🌐
Medium
johnnie-agonz71.medium.com › react-useselector-usedispatch-9e72c7f25d7e
React useSelector & useDispatch. React has many features that are… | by Johnnie Gonzalez | Medium
February 21, 2021 - In this case it is called “counter”. This allows us to get state and use it in this example to show the current counter. As for “useDispatch” this allows us to “dispatch” a certain action to our reducer.
🌐
Blogger
javarevisited.blogspot.com › 2021 › 09 › usedispatch-and-use.html
How to use useDispatch and useSelector? React Hooks Example Tutorial
May 22, 2023 - These two hooks eliminate the use of the complicated connect() method. In this article, we will discuss what are useDispatch and useSelector hooks and how can we use them in a react application to manage the state.
🌐
DEV Community
dev.to › bangash1996 › introduction-react-redux-using-hooks-useselector-usedispatch-26ch
Introduction React-Redux using Hooks (useSelector && useDispatch) - DEV Community
June 5, 2021 - We will invoke useDispatch and store it to a variable, dispatch. This hook returns a reference to the dispatch function from the Redux store. You may use it to dispatch actions as needed.
🌐
Thoughtbot
thoughtbot.com › blog › using-redux-with-react-hooks
Using Redux with React Hooks
July 19, 2023 - Now, with the new React Redux Hooks instead of connect: import React from "react"; import { useDispatch, useSelector } from "react-redux"; import { addCount } from "./store/counter/actions"; export const Count = () => { const count = useSelector((state) => state.counter.count); const dispatch = useDispatch(); return ( <main> <div>Count: {count}</div> <button onClick={() => dispatch(addCount())}>Add to count</button> </main> ); };
🌐
YouTube
youtube.com › watch
React Redux Tutorials - 21 - useDispatch Hook - YouTube
📘 Courses - https://learn.codevolution.dev/💖 Support UPI - https://support.codevolution.dev/💖 Support PayPal - https://www.paypal.me/Codevolution💾 Github...
Published   October 14, 2019
🌐
Tabnine
tabnine.com › home page › code › javascript › react-redux
How to use useDispatch function in react-redux - Javascript
export default function useActions(actions, deps) { const dispatch = useDispatch(); return useMemo( () => { if(Array.isArray(actions)) { return actions.map(a => bindActionCreators(a, dispatch)); } return bindActionCreators(actions, dispatch); }, deps ? [dispatch, ...deps] : deps ); } ... React.memo(function UserItem({ name, id }) { useRenderTracking(`UserItem: ${name}`); const dispatch = useDispatch(); const onRemove = () => { dispatch(setUserRemoving()); Api.removeUser({ name, id }) .then(() => dispatch(setUserRemoved({ name, id }))) .catch(() => dispatch(setUserRemoveError())); }; return <ListItem onRemove={onRemove}>{name}</ListItem>; })
🌐
Reddit
reddit.com › r/reduxjs › how do i avoid usedispatch in every component without breaking my app?
r/reduxjs on Reddit: How do I avoid useDispatch in every component without breaking my app?
July 24, 2021 -

I'm trying to refactor an app's state to use redux toolkit. Something I'm frustrated by is how `useDispatch` needs to be imported into every component along with the actions. Does it make sense to make a `useAppHandlers` hook that returns all the prepared handlers?

More context here:
https://stackoverflow.com/questions/68506544/is-this-a-dumb-idea-for-how-to-simplify-redux-react