mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
32 lines
679 B
Plaintext
32 lines
679 B
Plaintext
|
// @flow
|
||
|
import { Component, type Node } from 'react';
|
||
|
|
||
|
type RenderFn<T> = (value: T) => Node;
|
||
|
|
||
|
export type ProviderProps<T> = {
|
||
|
value: T,
|
||
|
children?: Node
|
||
|
};
|
||
|
|
||
|
export type ConsumerProps<T> = {
|
||
|
children: RenderFn<T> | [RenderFn<T>],
|
||
|
observedBits?: number
|
||
|
};
|
||
|
|
||
|
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: Class<Provider<T>>,
|
||
|
Consumer: Class<Consumer<T>>
|
||
|
};
|
||
|
|
||
|
declare export default function createReactContext<T>(
|
||
|
defaultValue: T,
|
||
|
calculateChangedBits?: (prev: T, next: T) => number
|
||
|
): Context<T>;
|