I have route defined as below :
<Route path='/result/:searchTerm' component={Result}/>
It works fine. For example localhost:3000/result/cat
page works. But when the user decided to remove the :searchTerm
from the URL and opens just localhost:3000/result/
it shows empty page. No errors or anything. Just empty page. It is not even hitting my component {Result}
too.
So my doubt is how to handle this scenario.? Say I want to redirect the user who tries to open /result/
without :searchTerms
to my index page.? How to do that.?