Because the host serves 404 for routes that are not files, since routing is client-side. Configure the host to redirect all routes to index.html, so React Router loads and handles the route.
Common React UI Bugs and How to Fix Them
Why do I get a 404 after deploying my React app?
The answer
More FAQs in Common React UI Bugs and How to Fix Them
Usually a build error, a wrong API URL, or a missing environment variable. Check the console and the Network tab. Often an error boundary is missing, so an unhandled error leaves the user staring at white.
Usually a wrong useEffect dependency array or a stale closure. Fix the dependency array with the hooks lint plugin, so the effect re-runs when the relevant values change and uses the latest values.
Because you used the array index as the key, so React reuses the wrong elements when the list changes. Use a stable unique id from your data as the key for every list item.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.