1.0.12 • Published 3 years ago

rax-polyfill-context v1.0.12

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

rax-polyfill-context

Polyfill for Rax new context api

Support

>= rax@0.6.5

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