bigbuffet-rw/app/soapbox/hooks/useGetState.ts

14 lines
367 B
TypeScript
Raw Normal View History

2023-03-13 15:45:35 -07:00
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 };