UNPKG

refun

Version:

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

1 lines • 837 B
{"version":3,"sources":["redux-dispatch-factory.ts"],"names":["ReduxDispatchFactory","context","dispatchName","props","dispatch"],"mappings":";;;;;;;;;;;AAAA;;AAKO,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,CAAsBC,OAAtB;AAAA,SAAkD,UAAmBC,YAAnB;AAAA,WACtF,UAAeC,KAAf;AAAA,wCACOA,KADP,oCAEKD,YAFL,EAEoB,uBAAWD,OAAX,EAAoBG,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"}