UNPKG

refun

Version:

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

1 lines 702 B
{"version":3,"sources":["map-context.ts"],"names":["useContext","mapContext","context","props","contextProps"],"mappings":"AAAA,SAASA,UAAT,QAA2B,OAA3B;AAIA,OAAO,IAAMC,UAAU,GAAG,SAAbA,UAAa,CAAiBC,OAAjB;AAAA,SAA0C,UAAeC,KAAf,EAA4C;AAC9G,QAAMC,YAAY,GAAGJ,UAAU,CAACE,OAAD,CAA/B;AAEA,6BACKC,KADL,EAEKC,YAFL;AAID,GAPyB;AAAA,CAAnB","sourcesContent":["import { useContext } from 'react'\nimport type { Context } from 'react'\nimport type { TExtend } from 'tsfn'\n\nexport const mapContext = <CP extends {}> (context: Context<CP>) => <P extends {}>(props: P): TExtend<P, CP> => {\n const contextProps = useContext(context)\n\n return {\n ...props,\n ...contextProps,\n }\n}\n"],"file":"map-context.js"}