UNPKG

@thejohnfreeman/loadable

Version:
12 lines (11 loc) 480 B
import * as React from 'react'; declare type LoadableOptions = { delay?: number; Placeholder?: React.ComponentType; }; declare type Imported<P> = React.ReactNode | React.ComponentType<P> | { default: Imported<P>; }; export declare type Fetch<P> = (props: P) => Promise<Imported<P>>; export declare const loadable: ({ delay, Placeholder, }?: LoadableOptions) => <P extends object>(fetchElement: (props: P) => Promise<Imported<P>>) => React.ComponentType<P>; export {};