Hosting a React application on the Netlify platform often runs into an “Error 404”. This is because an app built with Reactjs is a SPA (Single Page Application). Routing is done on the application and no HTTP calls are made to fetch pages server-side.
To fix this error,
- go to the
publicfolder of your application
- create a file name
_redirects( no file extension)
- add the following content to the
/* /index.html 200
- Rebuild the application and the error is fixed.
This tells Netlify to route all redirects to the
index.html which is the root entry of your application. In Firebase hosting, this is usually handled inside a config file inside the project root.