如何将多态道具添加到React组件?
我尝试了以下内容,但结果是:
T. This type is incompatible with some incompatible instantiation of T
示例:
/* @flow */
import React from 'react';
type Props<T> = {
promise: () => Promise<T>
}
export default class Async<T> extends React.Component {
props: Props<T>;
}
答案 0 :(得分:2)
奇怪的错误,你可以试试这个
/* @flow */
import React from 'react';
type Props<T> = {
promise: () => Promise<T>
}
export default class Async<T> extends React.Component<*, Props<T>, *> {}