<Switch>
<Route path='/deposit' component={DepositComponent} />
<Route path='/withdraw' component={Withdraw} />
<Route path='/messages/:convoId?' component={MessagesComponent} />
<Route exact path='' render={(routeProps) => <MainContent {...this.props} {...routeProps} />} />
</Switch>
每当我将路由从/ messages更改为/ messages /:convoId时,就在MessagesComponent路由中重新安装该组件。我不认为它应该重新安装,因为它是相同的路径和Route组件。