refun
Version:
A collection of React Hook-enabled functions that compose harmoniously with each other. Similar to `recompose`, but:
1 lines • 877 B
Source Map (JSON)
{"version":3,"sources":["redux-dispatch-factory.ts"],"names":["useContext","ReduxDispatchFactory","context","dispatchName","props","dispatch"],"mappings":";AAAA,SAASA,UAAT,QAA2B,OAA3B;AAKA,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAsBC,OAAtB;AAAA,SAAkD,UAAmBC,YAAnB;AAAA,WACtF,UAAeC,KAAf;AAAA,+BACOA,KADP,sBAEKD,YAFL,EAEoBH,UAAU,CAACE,OAAD,CAAV,CAAoBG,QAFxC;AAAA,KADsF;AAAA,GAAlD;AAAA,CAA7B","sourcesContent":["import { useContext } from 'react'\nimport type { Context } from 'react'\nimport type { Store } from 'redux'\nimport type { TExtend } from 'tsfn'\n\nexport const ReduxDispatchFactory = <STORE extends Store>(context: Context<STORE>) => <K extends string>(dispatchName: K) =>\n<P extends {}>(props: P): TExtend<P, { [k in K]: STORE['dispatch'] }> => ({\n ...props,\n [dispatchName]: useContext(context).dispatch,\n }) as any\n"],"file":"redux-dispatch-factory.js"}