Reputation: 543
I have a simple app where I try to interchange between 2 routes, and for each route there is a specific component to be rendered. Unfortunately, it seems like it remains stuck on the first Route
I set inside the Switch
.
Here you can access a sandbox containing the simplified app. I have set 2 NavLink components to manage the 2 routes.
Upvotes: 0
Views: 17
Reputation: 396
in the builer component, you should use path instead to :
<Route path="/checkout" exact render={() => <div>Checkout</div>} />
<Route path="/" exact>
{this.state.showModal ? <div>Modal {orderSummary}</div> : null}
<div>Main Page</div>
{this.state.error ? errorMessage : ingredientControls}
</Route>
I tried it, it's work
Upvotes: 1