My react app work fine in dev mode, but as soon as I change page the app reloads and in production mode it doesn’t work. It’s because the app reloads and it’s okay in dev mode, but not in production mode
I use react-router-dom and I have tried changing the path without result.
I have made it in codesandbox.io here, it works but it still reloads the app and I can’t see what’s wrong
EDIT:
it’s all under cv because it’s going to be in a folder called cv (cv == resume) like this => http://firstname.lastname.com/cv
2
Answers
Try this in your navbar:
I moved most of the code into same file (Just for convince to copy from here and not to have to create many different files). However I still use your navbar as it was before (in the sandbox).
Not sure why you had the nav bar under cv. But moved it to the root. However to have Sub menu I created to links that should symbolise that without any css styling.
Now when the layout is moved out (could been its own file so the routes). It works without the whole page refreshes. Only the affected route
app.jsx
I also suggest that you update app.jsx to look like this and use strict mode: