rax-polyfill-context

1.0.12 • Public • Published

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

Package Sidebar

Install

npm i rax-polyfill-context

Weekly Downloads

0

Version

1.0.12

License

MIT

Unpacked Size

4.9 kB

Total Files

4

Last publish

Collaborators

  • kingback