UNPKG

769 BSource Map (JSON)View Raw
1{"version":3,"file":"use-with.umd.min.js","sources":["../src/index.js"],"sourcesContent":["import * as React from 'react';\n\nexport function useFC(render) {\n const renderRef = React.useRef();\n renderRef.current = render;\n\n return React.useRef(function RenderFunctionWrapper(restProps) {\n return renderRef.current(restProps);\n }).current;\n}\n\nexport default function useWith(Wrapped, props) {\n return useFC((restProps) => <Wrapped {...props} {...restProps} />);\n}\n"],"names":["useFC","render","renderRef","React","current","restProps","Wrapped","props","React.createElement"],"mappings":";;;;;qeAEO,SAASA,EAAMC,OACdC,EAAYC,kBAClBD,EAAUE,QAAUH,EAEbE,UAAa,SAA+BE,UAC1CH,EAAUE,QAAQC,MACxBD,kBAGU,SAAiBE,EAASC,UAChCP,GAAM,SAACK,UAAcG,gBAACF,OAAYC,EAAWF"}
\No newline at end of file