DEV Community

Discussion on: Unable to navigate to pages in react (MERN app) which is deployed on Heroku

Collapse
 
alifarhad profile image
Farhad Ali

I had the same issue. I fixed it the following way:

once you have built the react app with npm build command then you need to go to public directory and add a new file called:

_redirects

content of the file should be:

/* /index.html 200

you can check this in my repo:
github.com/ali-farhad/material-ui-...

Collapse
 
deepikasharma5 profile image
Deepika Sharma

That is aalo not working. Do I need to mention that file in somewhere?

Collapse
 
alifarhad profile image
Farhad Ali • Edited

no does not need to be mentioned anywhere. but again you have a MERN app. I had CRA app so that is why this solution might not apply to your project.

Thread Thread
 
deepikasharma5 profile image
Deepika Sharma

Oh may be that's the reason