1
我一直在读通过流量库的源代码,并在几个地方,我看到这个符号:这个奇怪的三元操作是什么?
?: ?
我不知道这是一个奇怪的使用三元运算符,或别的东西完全。
function createFunctional<Props, State, A, B>(
viewFn: (props: State) => React.Element<State>,
getStores: (props?: ?Props, context?: any) => Array<FluxStore>,
calculateState: (prevState?: ?State, props?: ?Props, context?: any) => State,
options?: Options,
): ReactClass<Props> {
/** Omitted Implementation Details **/
};
正在发生的事情在这里,如在props?: ?Props
:这个混乱的用法
几个很好的例子可以在函数声明开始就line 245 of the FluxContainer.js文件中发现了什么?