mini-create-react-context

  • Version 0.4.1
  • Published
  • 19.7 kB
  • 2 dependencies
  • MIT license

Install

npm i mini-create-react-context
yarn add mini-create-react-context
pnpm add mini-create-react-context

Overview

Smaller Polyfill for the proposed React context API

Index

Functions

function createReactContext

createReactContext: <T>(
defaultValue: T,
calculateChangedBits?: (prev: T, next: T) => number
) => Context<T>;

    Type Aliases

    type ConsumerProps

    type ConsumerProps<T> = {
    children: RenderFn<T> | [RenderFn<T>];
    observedBits?: number;
    };

      type Context

      type Context<T> = {
      Provider: React.ComponentClass<ProviderProps<T>>;
      Consumer: React.ComponentClass<ConsumerProps<T>>;
      };

        type ProviderProps

        type ProviderProps<T> = {
        value: T;
        children?: React.ReactNode;
        observedBits?: any;
        };

          type RenderFn

          type RenderFn<T> = (value: T) => React.ReactNode;

            Package Files (1)

            Dependencies (2)

            Dev Dependencies (23)

            Peer Dependencies (2)

            Badge

            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/mini-create-react-context.

            • Markdown
              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/mini-create-react-context)
            • HTML
              <a href="https://www.jsdocs.io/package/mini-create-react-context"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>