bigbuffet-rw/app/soapbox/hooks/useGetState.ts
2023-03-13 17:45:35 -05:00

14 lines
No EOL
367 B
TypeScript

import { useAppDispatch } from './useAppDispatch';
import type { RootState } from 'soapbox/store';
/**
* Provides a `getState()` function to hooks.
* You should prefer `useAppSelector` when possible.
*/
function useGetState() {
const dispatch = useAppDispatch();
return () => dispatch((_, getState: () => RootState) => getState());
}
export { useGetState };