UNPKG

@lonelyplanet/dotcom-core

Version:

This package is meant to house some of our more common UI and shared libs across dotcom applications.

36 lines (35 loc) 1.88 kB
import * as React from "react"; export interface IAsyncComponentState { Component?: typeof React.Component; } export declare type IGetComponent = () => Promise<typeof React.Component>; export default function asyncComponent(getComponent: IGetComponent): { new (props: any): { state: { Component?: typeof React.Component; }; componentWillMount(): void; render(): JSX.Element; context: any; setState<K extends "Component">(state: IAsyncComponentState | ((prevState: Readonly<IAsyncComponentState>, props: null) => IAsyncComponentState | Pick<IAsyncComponentState, K>) | Pick<IAsyncComponentState, K>, callback?: () => void): void; forceUpdate(callBack?: () => void): void; readonly props: Readonly<{ children?: React.ReactNode; }>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: null, nextState: Readonly<IAsyncComponentState>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: null, prevState: Readonly<IAsyncComponentState>): any; componentDidUpdate?(prevProps: null, prevState: Readonly<IAsyncComponentState>, snapshot?: any): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: null, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: null, nextContext: any): void; componentWillUpdate?(nextProps: null, nextState: Readonly<IAsyncComponentState>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: null, nextState: Readonly<IAsyncComponentState>, nextContext: any): void; }; contextType?: React.Context<any>; };