我有一個註冊模式,看起來像:如何使用React/Redux組件將2個模塊合併爲1?
現在,我讓他們爲2個獨立的反應的組分從我的NavBar作爲觸發如下:
<Nav pullRight className="navright">
<NavItem eventKey={3} href="#">Stuff</NavItem>
<NavItem eventKey={4} href="#">Blog</NavItem>
<NavItem href="#" className={this.state.signedIn ? '' : 'hidden'}>{this.state.name}</NavItem>
<NavItem eventKey={2} href="#" className={this.state.signedIn ? 'hidden' : ''}><SignupModal/></NavItem>
<NavItem eventKey={1} href="#" className={this.state.signedIn ? 'hidden' : ''}><LoginModal/></NavItem>
</Nav>
我想將它們組合成一個模態分量(可能稱爲AuthModal
)和塔將加載所選的適當組件。
如果有問題,我正在使用react-bootstrap
。我是React的新手,所以如果有什麼不清楚的地方,請讓我知道,我會澄清。
謝謝。
您需要的內容結合SignupModal和LoginModal組成一個名爲AuthModal的新組件。從渲染功能開始,並以功能的方式工作。它與任何其他反應/ DOM工作沒有區別。 –