• Creates a "pre-typed" version of useDispatch useDispatch where the type of the dispatch function is predefined.

    This allows you to set the dispatch type once, eliminating the need to specify it with every useDispatch useDispatch call.

    Type Parameters

    • OverrideDispatchType extends ThunkDispatch<{
          app: AppState;
      }, undefined, UnknownAction> & Dispatch<UnknownAction>

      The specific type of the dispatch function.

    Returns UseDispatch<OverrideDispatchType>

    A pre-typed useDispatch with the dispatch type already defined.

    Example

    export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
    

    Since

    9.1.0

Generated using TypeDoc