Files
ncd-fe/packages/pl-fe/src/hooks/useGetState.ts
marcin mikołajczak 966b04fdf0 Call it pl-fe internally
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-28 13:41:08 +02:00

15 lines
370 B
TypeScript

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