Let's say I have these routes:
<Switch>
<Route path="/my-profile" component={MyProfile} />
<Route path="/logout" component={Logout} />
<Route component={NotFound} />
</Switch>
Handling 404 page works okay if I type anything other than my-profile
or logout in the address bar. However, if I will type .../my-profile/paththatdoesntexist
, I will still see the profile page. How to handle such cases? to show not found page regardless of how much nested the path is.