Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, ReactChildren } from 'react';
- export type ProviderProps<T> = {
- value: T,
- children?: ReactChildren
- };
- export type ConsumerProps<T> = {
- children: (value: T) => ReactChildren
- };
- export type ConsumerState<T> = {
- value: T
- };
- export type Provider<T> = Component<ProviderProps<T>>;
- export type Consumer<T> = Component<ConsumerProps<T>, ConsumerState<T>>;
- export type Context<T> = {
- Provider: new (...args: any[]) => Provider<T>,
- Consumer: new (...args: any[]) => Consumer<T>,
- };
- export default function createReactContext<T>(
- defaultValue: T
- ): Context<T>;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement