CR

Create React Context

create-react-context

Polyfill for the proposed React context API

Utilities
react
context
contextTypes
polyfill
ponyfill
create-react-context
Utilities
javascript
npm
frontend
Stars
686
Weekly
620k
Open issues
9
Bundle
~25 kB

Installation

npm install create-react-context

Code example

import { useCreateReactContext } from "create-react-context";

export function Example() {
  const value = useCreateReactContext();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by James Kyle
  • 620k weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 9 open issues on GitHub

FAQs

Alternatives & similar libraries