I have the following code and I am going to handle nested route while wrong one is entered:
<Switch>
<Route path="/" exact component={Home} />
<Route path="/sample" exact component={Sample} />
<Route path="/sample/example/:id" exact component={Example} />
<Route path="/sample/:example" exact component={Example} />
<Route component={404}/>
</Switch>
If user enters localhost:3000/something-wrong
, it will show 404 page correctly. However, when he enters localhost:3000/sample/something-wrong
, nothing is rendered!
How should I handle this issue in a manner way?