UNPKG

refun

Version:

A collection of React Hook-enabled functions that compose harmoniously with each other. Similar to `recompose`, but:

1 lines • 967 B
{"version":3,"sources":["store-context-factory.tsx"],"names":["StoreContextFactory","store","Context","mapStoreState","mapStoreDispatch"],"mappings":";;;;;AAAA;;AAEA;;AACA;;AAEO,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,CAAuBC,KAAvB,EAAwC;AACzE,MAAMC,OAAO,GAAG,0BAAcD,KAAd,CAAhB;AAEA,SAAO;AACLC,IAAAA,OAAO,EAAPA,OADK;AAELC,IAAAA,aAAa,EAAE,0CAAiDD,OAAjD,CAFV;AAGLE,IAAAA,gBAAgB,EAAE,gDAA4BF,OAA5B;AAHb,GAAP;AAKD,CARM","sourcesContent":["import { createContext } from 'react'\nimport type { Store } from 'redux'\nimport { ReduxDispatchFactory } from './redux-dispatch-factory'\nimport { ReduxStateFactory } from './redux-state-factory'\n\nexport const StoreContextFactory = <STORE extends Store> (store: STORE) => {\n const Context = createContext(store)\n\n return {\n Context,\n mapStoreState: ReduxStateFactory<ReturnType<STORE['getState']>>(Context as any),\n mapStoreDispatch: ReduxDispatchFactory<STORE>(Context),\n }\n}\n\n"],"file":"store-context-factory.js"}