Redux Toolkit / React Redux

useDispatch

Returns the dispatch function for the current provided store.

Formal Syntax & Structure

react syntaxreact
const dispatch = useDispatch()

Working Example

Example Snippetreact
const dispatch = useDispatch()
React Reference