未知错误:不变冲突:元素类型无效:期望字符串(用于内置组件)或类/函数,但get:object我得到了这个错误:不变量错误:不变冲突:元素类型无效:预期字符串(用于内置组件)或类/函数(用于组合组件),但get:Object。这是我的密码:var React = require('react')var ReactDOM = require('react-dom')var Router = require('react-router')
var Route = Router.Routevar Link = Router.Linkvar App = React.createClass({
render() {
return (
<div>
<h1>App</h1>
<ul>
<li><Link to="/about">About</Link></li>
</ul>
</div>
)
}})var About = require('./components/Home')ReactDOM.render((
<Router>
<Route path="/" component={App}>
<Route path="about" component={About} />
</Route>
</Router>), document.body)我的Home.jsx档案:var React = require('react');var RaisedButton = require('material-ui/lib/raised-button');var Home = React.createClass({
render:function() {
return (
<RaisedButton label="Default" />
);
},});module.exports = Home;
3 回答
潇湘沐
TA贡献1816条经验 获得超6个赞
import {MyComponent} from '../components/xyz.js';
import MyComponent from '../components/xyz.js';
慕哥9229398
TA贡献1877条经验 获得超6个赞
var YourReactComponent = React.createClass({ render: function() { ...
module.exports = React.createClass({ render: function() { ...
添加回答
举报
0/150
提交
取消