UNPKG

@shopify/react-async

Version:

Tools for creating powerful, asynchronously-loaded React components.

22 lines (21 loc) 792 B
import React, { Context, ComponentType } from 'react'; import { ResolverOptions } from '@shopify/async'; import { AsyncComponentType } from './types'; interface Options<Value> extends ResolverOptions<Value> { } interface ProviderProps { children?: React.ReactNode; } interface ConsumerProps<Value> { children(value: Value | null): React.ReactNode; } export interface AsyncContextType<Value> { Context: React.Context<Value | null>; } export interface AsyncContextType<Value> extends AsyncComponentType<Value, never, {}, {}, {}> { Context: Context<Value | null>; Provider: ComponentType<ProviderProps>; Consumer: ComponentType<ConsumerProps<Value>>; } export declare function createAsyncContext<Value>({ id, load, }: Options<Value>): AsyncContextType<Value>; export {};