Reputation: 157
Below is my attached routes, When I navigate to /login/schoolname. I get the correct component, but when I navigate to the verify, it appends onto /login/verify.
<Switch>
<Route path="/verify" component={Verify} />
<Route path="/login/:schoolName" component={Login} />
<Route path="*" component={Home} />
</Switch>
I was expecting, some thing like localhost/verify localhost/login/schoolname whenever I click on the navigation
Upvotes: 2
Views: 425
Reputation: 8632
change the route in order to match the path exactly
<Route exact path="/verify" component={Verify} />
and when you manually change the route be sure to put the slash in the front of the route name
history.push("/verify");
Upvotes: 5