2017-05-05 31 views
0

我试图创建一个反应,引导我的Django应用程序模式窗口属性“组件”,我实现了这样的反应,引导无法读取的不确定

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') 
); 

的JSX文件,但是当我运行我的应用程序在浏览器控制台中收到错误

Uncaught TypeError: Cannot read property 'Component' of undefined

回答

0

您可能忘记导入或导出组件正确。

+0

我需要导入什么? – ChemseddineZ

+0

importi el component sa7bi elbéhii –

+0

错误告诉你它无法找到一个名为“Component”的组件。这也可能意味着需要定义childContextTypes或Context类型。我假设这些组件正在使用流量架构,因此您需要导入模态和按钮。 http://stackoverflow.com/questions/30717886/cannot-read-component-of-undefined-using-material-ui-with-browserify – Demon