困惑流量与打字反应的组分

问题描述:

我有点困惑哪个流类型的使用反应成分
我的代码在这里部分:困惑流量与打字反应的组分

// @flow 
import React from 'react'; 
import Stage from '../../../shared/sections/Stage'; 

interface WithContent { 
    content: any, 
} 

class DynamicContent extends React.PureComponent { 
    props: { 
    content: [], 
    }; 

    static componentsMap = { 
    dn_module_stage: Stage, 
    }; 

    static getComponent(identifier: string): ?React$Element<WithContent> { 
    if (Object.prototype.hasOwnProperty.call(DynamicContent.componentsMap, identifier)) { 
     return DynamicContent.componentsMap[identifier]; 
    } 
    return null; 
    } 

    static renderComponent(component: GenericComponent, key: number): ?React$Element<WithContent> { 
    const Component: any = DynamicContent.getComponent(component.type); 
    if (Component) { 
     return <Component key={key} content={component.content} />; 
    } 
    return null; 
    } 
    ... 
    ... 

大概接口是不必要的,我应该只使用阵营$ Element < *>,对吗?
我想输入这行但没有成功,我应该使用什么而不是任何?

const Component: any = DynamicContent.getComponent(component.type); 

是否有反应正确使用流量的良好来源?我刚刚找到一篇文章和正式文件不多。任何github代码示例回购?

您可以检查Github上的代码流中使用的流量回购。例如,https://github.com/facebook/flux/blob/master/examples/flux-async/src/views/AppView.js

+0

thx,我会检查重做 – jeff