rest-countries-api-with-color-theme-switcher

Solution retrospective
Hi everyone, I completed my REST-COUNTRIES-API challenge. I faced difficulty when I go to a country details page, if I hit refresh, the site crashes with a 404 status code.
After some debugging and research I found that it was related to client-side routing, and there are multiple ways to deal with that issue, one of which is to use hash-router instead of browser-router, but that's not recommended.
The way I chose to take is Netlify specific, add a _redirects file to the public folder in my react app that redirects all the routes to the index.html. You can find more details in this article: https://dev.to/dance2die/page-not-found-on-netlify-with-react-router-58mc More information about redirects on Netlify's documentation: https://docs.netlify.com/routing/redirects/
Happy coding!!
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Ammar Jalabi's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord