我试图在我的页面上使用React-bootstrap,但在我的第一个组件上遇到错误。我已经用yeoman generator搭建了一个页面,并尝试将react-bootstrap添加到其中。
import {Grid} from 'react-bootstrap';
import {Row} from 'react-bootstrap';
import {Col} from 'react-bootstrap';
class Application extends React.Component {
render() {
var Handler = this.props.currentRoute.get('handler');
return (
<div>
<Grid>
<Row>
<Col xs={12} md={8}>
<Nav selected={this.props.currentPageName} links={this.props.pages} />
</Col>
</Row>
<Row>
<Col>
<Handler />
</Col>
</Row>
</Grid>
</div>
);
}但是当我运行它时,我得到了错误Error: Invariant Violation: Grid.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.
发布于 2015-12-12 22:55:10
可变生成器使用react 0.13,它与react-bootstrap不兼容。在将react升级到0.14.3之后,它可以正常工作。
https://stackoverflow.com/questions/34240285
复制相似问题