组件<{}、{}、状态>。 React 中的语法是什么?
Component<{}, {}, State>. What is this Syntax in React?
我正在研究 Flux Utils TodoMVC 示例(来自 Flux GitHub site) and is confused over the following syntax (code brevity here) present in TodoApp.react.js 文件
class TodoApp extends Component<{}, {}, State> {
// ...
// ....................
}
这个语法告诉我们什么?
这是 Bounded Polymorphism (generics), a feature from FlowType,Facebook 在其 Flux 示例中使用了它。
流文件的顶部都有一个 @flow
注释。
我正在研究 Flux Utils TodoMVC 示例(来自 Flux GitHub site) and is confused over the following syntax (code brevity here) present in TodoApp.react.js 文件
class TodoApp extends Component<{}, {}, State> {
// ...
// ....................
}
这个语法告诉我们什么?
这是 Bounded Polymorphism (generics), a feature from FlowType,Facebook 在其 Flux 示例中使用了它。
流文件的顶部都有一个 @flow
注释。