DEV Community

Discussion on: Creating 404 page in react using React Router

Collapse
 
tonixtuft profile image
Anton Bagdatyev (Tonix-Tuft)

How can you return a 404 status code with this SPA approach? If a URL does not effectively exists, a 404 would be more semantically correct than a 200 response code. Is there a way to achieve this somehow while using SPA?

Collapse
 
learnwithparam profile image
Paramanantham Harrison

Unless you sever rendered 404 page, it’s not possible
Will surely research more into the details on how to do it in SPA

Collapse
 
tonixtuft profile image
Anton Bagdatyev (Tonix-Tuft)

Thank you for your reply. I will too!