import React from "react";
/**
* 解决不支持服务端渲染的 组件 import 问题
* https://zhuanlan.zhihu.com/p/68218860
*
* 注意:
* 1. 使用该组件需要在类的外部(文件级作用域)异步导入
* 1.1 const ChartsArea = AsyncComponent(() => import("../../../components/ChartsArea"));
* 2. 不想使用该组件也可以通过强制客户端渲染的方式达到同样的效果(csr!)
* 2.1 import { Line } from 'csr!@ant-design/charts';
* 2.2 return typeof window !== "undefined" ? : null;
* 何时使用:
* 1. import @ant-design/charts 时报错: Error: Unable to parse color from object [247,249.7,255]
*/
interface IState {
component?: any;
}
declare const BasicAsyncComponent: (component: () => Promise) => {
new (props: any): {
state: {
component: any;
};
componentDidMount(): void;
render(): JSX.Element;
context: any;
setState(state: IState | ((prevState: Readonly, props: Readonly) => IState | Pick) | Pick, callback?: () => void): void;
forceUpdate(callback?: () => void): void;
readonly props: Readonly & Readonly<{
children?: React.ReactNode;
}>;
refs: {
[key: string]: React.ReactInstance;
};
shouldComponentUpdate?(nextProps: Readonly, nextState: Readonly, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, prevState: Readonly): any;
componentDidUpdate?(prevProps: Readonly, prevState: Readonly, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, nextState: Readonly, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, nextState: Readonly, nextContext: any): void;
};
new (props: any, context: any): {
state: {
component: any;
};
componentDidMount(): void;
render(): JSX.Element;
context: any;
setState(state: IState | ((prevState: Readonly, props: Readonly) => IState | Pick) | Pick, callback?: () => void): void;
forceUpdate(callback?: () => void): void;
readonly props: Readonly & Readonly<{
children?: React.ReactNode;
}>;
refs: {
[key: string]: React.ReactInstance;
};
shouldComponentUpdate?(nextProps: Readonly, nextState: Readonly, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, prevState: Readonly): any;
componentDidUpdate?(prevProps: Readonly, prevState: Readonly, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, nextState: Readonly, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, nextState: Readonly, nextContext: any): void;
};
contextType?: React.Context;
};
export default BasicAsyncComponent;