Skip to content

Instantly share code, notes, and snippets.

@victorbruce
Created October 24, 2022 09:58
Show Gist options
  • Save victorbruce/3ab63406179b5ba80ecb5df01da1746d to your computer and use it in GitHub Desktop.
Save victorbruce/3ab63406179b5ba80ecb5df01da1746d to your computer and use it in GitHub Desktop.
import {TypedUseSelectorHook, useDispatch, useSelector} from "react-redux"
import type {RootState, AppDispatch} from "store"
// use throughout your app instead of useDispatch and useSelector
export const useAppDispatch: () => AppDispatch = useDispatch
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment