9 lines
380 B
TypeScript
9 lines
380 B
TypeScript
import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux";
|
|
import type { AppDispatch, RootState } from "./index";
|
|
|
|
// Use throughout your app instead of plain `useDispatch` and `useSelector`
|
|
const useAppDispatch = () => useDispatch<AppDispatch>();
|
|
const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
|
|
export { useAppDispatch, useAppSelector };
|