我想实现React-Router到现有的反应应用程序。作为变量的反应路由器组件处理
如何根据某些条件使用react-router来显示组件。
var displayRHS;
if(this.state.displayEventComponent){
{/*
* Events Menus
*/}
displayRHS = <DisplayEventComponent
parentFunc={this.displayComponentFunction}
parentPropDay={this.state.day}
/>
} else if (this.state.displayToDoListComponent){
{/*
* To Do List Menu
*/}
displayRHS = <DisplayToDoListComponent
parentCallback_2={this.updateDisplayToDoListComponent}
updateList={this.state.updateDisplayToDoListComponent}
displayIssuesNotList={false}
/>
} else if (this.state.displayIssuesComponent) {
{/*
* Issues menu
*/}
displayRHS = <DisplayIssuesComponent
parentCallback_2={this.updateDisplayToDoListComponent}
updateList={this.state.updateDisplayToDoListComponent}
displayIssuesNotList={true}
/>
}
显示路线打破
<Route exact path="/" component={displayRHS} />
如何显示在经过以及他们各自的道具,这些组件?
提前非常感谢
PS,我有种想,一个页面应该只是单页使用路由库应该是一个标志,你应该有一个页面刷新,而不是..