# Function useDispatch

- useDispatch<AppDispatch>(): AppDispatch

- A hook to access the redux `dispatch` function.

  #### Type Parameters

  - AppDispatch extends Dispatch<AnyAction> = Dispatch<AnyAction>

  #### Returns AppDispatch

  redux store's `dispatch` function

  #### Example

      import React, { useCallback } from 'react'
      import { useDispatch } from 'react-redux'

      export const CounterComponent = ({ value }) => {
        const dispatch = useDispatch()
        const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
        return (
          <div>
            <span>{value}</span>
            <button onClick={increaseCounter}>Increase counter</button>
          </div>
        )
      }

  - Defined in common/temp/node_modules/.pnpm/react-redux@8.1.3_91ee3f21853aee6f4038f22086c31182/node_modules/react-redux/es/hooks/useDispatch.d.ts:32