Reactjs react引导程序无法读取属性';组件';未定义的
我正在尝试为我的django应用程序创建一个带有react引导的模式窗口,我实现了如下jsx文件Reactjs react引导程序无法读取属性';组件';未定义的,reactjs,react-bootstrap,Reactjs,React Bootstrap,我正在尝试为我的django应用程序创建一个带有react引导的模式窗口,我实现了如下jsx文件 const WindowModal = React.createClass({ getInitialState(){ return {showModal: false}; }, close(){ this.setState({showModal: false}); }, open(){ this.setState({showModal: true}); }, render (
const WindowModal = React.createClass({
getInitialState(){
return {showModal: false};
},
close(){
this.setState({showModal: false});
},
open(){
this.setState({showModal: true});
},
render () {
return (
<div>
<p>Click!</p>
<Button bsStyle="primary" bsSize="large" onClick={this.open}>Launch</Button>
<Modal show={this.state.showModal} onHide={this.close}>
<Modal.Header closeButton>
<Modal.Title>Sign Up</Modal.Title>
</Modal.Header>
<Modal.Body>
<h1>Sign Up in Studio</h1>
</Modal.Body>
<Modal.Footer>
<Button onClick={this.close}>Close</Button>
</Modal.Footer>
</Modal>
</div>
);
}
});
ReactDOM.render(< WindowModal/>,
document.getElementById('contenu')
);
const WindowModal=React.createClass({
getInitialState(){
返回{showmodel:false};
},
关闭(){
this.setState({showmodel:false});
},
开(){
this.setState({showmodel:true});
},
渲染(){
返回(
点击
发射
注册
在工作室注册
接近
);
}
});
ReactDOM.render( ,
document.getElementById('contentNu')
);
但当我运行我的应用程序时,浏览器控制台会出现错误
未捕获的TypeError:无法读取未定义的属性“Component”
您可能忘记正确导入或导出组件。我需要导入什么?导入组件sa7bi el béhii错误告诉您找不到名为“组件”的组件。这也可能意味着您需要childContextTypes,或者需要定义上下文类型。我假设这些组件使用的是通量架构,所以您需要导入模态和按钮。