create-hook-context
A more powerful version of React.createContext
. Accepts a hook that takes in props for a provider, and then returned value of the hook, is the value provided to the context's consumers.
Signature:
; const ThemeProvider useTheme withThemeProvider ThemeContext = const Consumer = { const val = ; return <pre>JSON</pre>;}; const App = { return <ThemeProvider theme= a: 1 > <Consumer /> </ThemeProvider> ;}; /* or can use withThemeProvider to wrap components */ const App = ;