How can I add polymorphic props to a React component?
如何将多态道具添加到React组件?
I have tried the following, but it results in:
我尝试了以下内容,但结果如下:
T. This type is incompatible with some incompatible instantiation of T
T.这种类型与T的一些不兼容的实例化不兼容
Example:
/* @flow */
import React from 'react';
type Props<T> = {
promise: () => Promise<T>
}
export default class Async<T> extends React.Component {
props: Props<T>;
}
2
Strange error, you can try this instead
奇怪的错误,你可以试试这个
/* @flow */
import React from 'react';
type Props<T> = {
promise: () => Promise<T>
}
export default class Async<T> extends React.Component<*, Props<T>, *> {}
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2017/03/13/fae6e3b68f51988578f57f72f16a2771.html。