Answer the question
In order to leave comments, you need to log in
How to make route for 404 page?
Hello, I made a Route for 404 page, but it doesn't work as it should.
This is what the switch looks like:
<Switch>
<Route path = '/'>
<BigComponent>
<Switch
<Route path = '/contacts' component = { ContactsPage } />
<Route path = '/payment' component = { PaymentPage } />
</Switch>
</BigComponent>
</Route>
<Route component = { NotFoundPage } />
</Switch>
Answer the question
In order to leave comments, you need to log in
you can put a third route in the switch, something like
<Switch>
<Route path = '/contacts' component = { ContactsPage } />
<Route path = '/payment' component = { PaymentPage } />
<Route render={() => { return <Redirect to="/" />; }} />
</Switch>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question