79265969

Date: 2024-12-09 17:54:35
Score: 1
Natty:
Report link

When using react-router to create a single page app (SPA), you usually have to make a change to the server to make it serve the files correctly. Otherwise the server will try to respond with a file that matches your literal sub route address instead of your main index file. Hence the 404.

Github pages is a bit limited for the configuration of SPA page apps, but it looks like some people have found some workarounds including modifying the 404 template file.

See this page for some example configurations when setting up your app: page not found - react/vite app not routing correctly on github pages

You can also reference this repo as an example SPA: https://github.com/rafgraph/spa-github-pages

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: Chris