rtk-ready
Version:
Redux utilities package for a boilerplate setup with persisted state, authentication handling, API integration, and typed hooks, providing a structured and scalable state management solution for React applications.
10 lines (7 loc) • 423 B
text/typescript
// src/hooks/index.ts
import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux";
import type { RootState, AppDispatch } from "../store/store";
// Typed useDispatch hook for dispatching actions
export const useAppDispatch = () => useDispatch<AppDispatch>();
// Typed useSelector hook for accessing state in components
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;