Vote React app nested dynamic routes not working on deploy

Hi , I am trying to make a MERN stack app and I hosted my backend on render and the frontend on netlify, the problem is my root and posts route works fine and the data is fetched correctly but when I try to access the another nested route in the app like url/posts/:postId it is not working just a empty blank root element no errors, no 404, no nothing just blank page.

when I test it on my localhost it works correctly and there is no problem with it but in the production its not working I tried searching every where but not getting any difference other than the _redirects file approach which is also not working.

when I tried converting my project from vite to create-react-app and it works fine on deploy is there is a way to fix the site project ?

I’d appreciate if you have any ideas or solutions and thanks in advance.

and here is my rep and live links:

repo: GitHub - Adnanyu/setupSpot.

live: https://setup-spot.netlify.app/posts.

How to reproduce this error? Your website shows this:

I’m also facing similar issue. using reactjs & vite for my project.

All working fine after login. Traversing / navigation between pages. But after login, if I enter any route on the browser, the app crashes with the above issue.

I migrated my code to create-react-app and it worked, I think there is something wrong with router Dom and vice that they don’t work probably together.

Issue has been resolved. Please find the solution at javascript - Netlify and React Vite: Netlify says "Page not found" upon reloading in Vite and React site - Stack Overflow

1 Like