UNPKG

async-component

Version:

```jsx harmony import asyncComponent from 'async-component';

35 lines (34 loc) 1.24 kB
/// <reference types="react" /> import * as React from 'react'; import { Component } from "react"; export declare type ReactComponent = new () => Component<any, any>; export interface IFetchComponents { (): Promise<ReactComponent>; } declare const asyncComponent: (fetchComponent: IFetchComponents, Loader?: ReactComponent | undefined) => { new (props?: any, context?: any): { _isMounted: boolean; state: { Element: ReactComponent; }; componentDidMount(): void; componentWillUnmount(): void; render(): JSX.Element | null; setState<K extends "Element">(f: (prevState: { Element: ReactComponent; }, props: any) => Pick<{ Element: ReactComponent; }, K>, callback?: (() => any) | undefined): void; setState<K extends "Element">(state: Pick<{ Element: ReactComponent; }, K>, callback?: (() => any) | undefined): void; forceUpdate(callBack?: (() => any) | undefined): void; props: any; context: any; refs: { [key: string]: React.ReactInstance; }; }; Component: ReactComponent; }; export default asyncComponent;