UNPKG

recoil-toolkit

Version:
14 lines 492 B
import { useContext } from 'react'; import { useRecoilValue } from 'recoil'; import { reduxSelector } from './atoms'; import { RecoilReduxContext } from './context'; export function useSelector(selector) { return useRecoilValue(reduxSelector(selector)); } export function useDispatch() { const { store } = useContext(RecoilReduxContext); if (!store) throw new Error('RecoilReduxBridge with store not found!'); return store.dispatch; } //# sourceMappingURL=hooks.js.map