不变违规:元素类型无效:期望字符串(对于内置组件)或类/函数

时间:2016-03-29 19:11:06

标签: javascript jquery html reactjs redux

 /*
        Expose Non-connected component for unit testing
     */
    export { SportsTopPortion };

    export default connect(state => ({
        sportsAuthentication: state.template.sportsAuthentication,
        sportsPlayers: state.template.sportsPlayers,
        sportsUpperBar: state.template.sportsUpperBar
    }))(SportsTopPortion);


-even I changed class syntax but still not working

let SportsTopPortion = React.createClass({
    getInitialState () {
        return {
            disableMenuAnimation: false,
            isAuthenticationFlowActive: false,
            mobileMenuOpen: false      
        };
    },

/*class SportsTopPortion extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            disableMenuAnimation: false,
            isAuthenticationFlowActive: false,
            mobileMenuOpen: false
        };
    }*

**error**

警告:React.createElement:type不应为null,undefined,boolean或number。它应该是一个字符串(对于DOM元素)或一个ReactClass(对于复合组件)。 C:\体育整页\ node_modules \ FBJS \ LIB \ invariant.js:45     抛出错误;     ^

错误:不变违规:元素类型无效:期望一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:object。     at invariant(C:\ sports-whole-page \ node_modules \ fbjs \ lib \ invariant.js:39:15)     在instantiateReactComponent(C:\ sports-whole-page \ node_modules \ react \ lib \ instantiateReactComponent.js:64:134)     在instantiateChild(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactChildReconciler.js:29:28)     在traverseAllChildrenImpl(C:\ sports-whole-page \ node_modules \ react \ lib \ traverseAllChildren.js:98:5)     在traverseAllChildrenImpl(C:\ sports-whole-page \ node_modules \ react \ lib \ traverseAllChildren.js:114:23)     在traverseAllChildren(C:\ sports-whole-page \ node_modules \ react \ lib \ traverseAllChildren.js:186:10)     at Object.ReactChildReconciler.instantiateChildren(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactChildReconciler.js:52:5)     在ReactDOMComponent.ReactMultiChild.Mixin._reconcilerInstantiateChildren(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactMultiChild.js:197:41)     在ReactDOMComponent.ReactMultiChild.Mixin.mountChildren(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactMultiChild.js:232:27)     在ReactDOMComponent.Mixin._createContentMarkup(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactDOMComponent.js:591:32)     在ReactDOMComponent.Mixin.mountComponent(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactDOMComponent.js:479:29)     at Object.ReactReconciler.mountComponent(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactReconciler.js:37:35)     at [object Object] .ReactCompositeComponentMixin.mountComponent(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactCompositeComponent.js:225:34)     at [object Object] .wrapper [as mountComponent](C:\ sports-whole-page \ node_modules \ react \ lib \ ReactPerf.js:66:21)     at Object.ReactReconciler.mountComponent(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactReconciler.js:37:35)     at [object Object] .ReactCompositeComponentMixin.mountComponent(C:\ sports-whole-page \ node_modules \ react \ lib \ ReactCompositeComponent.js:225:34)

0 个答案:

没有答案