rax-polyfill-context
v1.0.12
Published
Rax createContext polyfill
Downloads
5
Readme
rax-polyfill-context
Polyfill for Rax new context api
Support
Usage
import { render } from 'rax';
import { createContext } from 'rax-polyfill-context';
const Context = createContext();
function App() {
return (
<div>
<Context.Consumer>{(value) => (
<p>{value}</p>
)}</Context.Consumer>
</div>
);
}
render((
<Context.Provider value={0}>
<App />
</Context.Provider>
), document)
For more usage, see https://reactjs.org/docs/context.html#reactcreatecontext
Others
You can use it with rax-polyfill-ref and rax-polyfill-hooks