代码段
export { SportsTopPortion };
export default connect(state => ({
sportsAuthentication: state.template.sportsAuthentication,
sportsPlayers: state.template.sportsPlayers,
sportsUpperBar: state.template.sportsUpperBar
}))(SportsTopPortion);
错误
ERROR: Command: 'node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js' failed with exit code 1: 'Current sports_enc: development
Using DEV build configuration
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite
C:\sports-whole-package\node_modules\fbjs\lib\invariant.js:45
throw error;
^
Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: obje
at invariant (C:\sports-whole-package\node_modules\fbjs\lib\invariant.js:39:15)
at instantiateReactComponent (C:\sports-whole-package\node_modules\react\lib\instantiateReactComponent.js:64:134)
at instantiateChild (C:\sports-whole-package\node_modules\react\lib\ReactChildReconciler.js:29:28)
at traverseAllChildrenImpl (C:\sports-whole-package\node_modules\react\lib\traverseAllChildren.js:98:5)
at traverseAllChildrenImpl (C:\sports-whole-package\node_modules\react\lib\traverseAllChildren.js:114:23)
at traverseAllChildren (C:\sports-whole-package\node_modules\react\lib\traverseAllChildren.js:186:10)
at Object.ReactChildReconciler.instantiateChildren (C:\sports-whole-package\node_modules\react\lib\ReactChildReconciler.js:52:5)
at ReactDOMComponent.ReactMultiChild.Mixin._reconcilerInstantiateChildren (C:\sports-whole-package\node_modules\react\lib\ReactMultiChild.js:197:41)
at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (C:\sports-whole-package\node_modules\react\lib\ReactMultiChild.js:232:27)
at ReactDOMComponent.Mixin._createContentMarkup (C:\sports-whole-package\node_modules\react\lib\ReactDOMComponent.js:591:32)
at ReactDOMComponent.Mixin.mountComponent (C:\sports-whole-package\node_modules\react\lib\ReactDOMComponent.js:479:29)
at Object.ReactReconciler.mountComponent (C:\sports-whole-package\node_modules\react\lib\ReactReconciler.js:37:35)
at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-package\node_modules\react\lib\ReactCompositeComponent.js:225:34)
at [object Object].wrapper [as mountComponent] (C:\sports-whole-package\node_modules\react\lib\ReactPerf.js:66:21)
at Object.ReactReconciler.mountComponent (C:\sports-whole-package\node_modules\react\lib\ReactReconciler.js:37:35)
at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-package\node_modules\react\lib\ReactCompositeComponent.js:225:34)'
答案 0 :(得分:0)
它没有那样的工作,但是那里的所有ES6为什么不一直这样做,就像文档说的那样呢?
export class SportsTopPortion extends React.Component {
constructor(props) {
super(props);
}...... all the rest of your code...
//note the use of React.Component not React.createClass
或者:
module.exports = React.createClass({
render: function() { ...
对此不确定:
export SportsTopPortion
不在底部,在顶部,您创建React类