import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; import { useAuthState } from '../components/auth/AuthContext'; import { type RootState, type AppDispatch } from './index'; // Use throughout your app instead of plain `useDispatch` and `useSelector` type DispatchFunc = () => AppDispatch; export const useAppDispatch: DispatchFunc = useDispatch; export const useAppSelector: TypedUseSelectorHook = useSelector; export const useRainbowAuth = () => { const { isLoading, storeUser, isAuthInProgress } = useAuthState(); const isAuthenticated = !!storeUser; return { isAuthenticated, isLoading: isLoading || isAuthInProgress, user: storeUser, }; };