DEV Community

loading...

Resolve routing problem in your React App when you deploy to Netlify

nkemjiks profile image Mbonu Blessing ・1 min read

Hello, everyone. I recently ran into a problem with routing when I deployed my react app to netlify. You may have ran into something like this before

Netlify routing page error

I found and article on freecodecamp which gave me a baseline but didn't provide a solution I needed. The article focused on deploying through the netlify cli and through their drag and drop feature on the UI.

This post is a addon for cases where you want to deploy when you push to github.

The solution is to add a netlify.toml file to root folder of your app with this piece of code and you are good to go...

netlify toml code snippet

Discussion (1)

pic
Editor guide
Collapse
dance2die profile image
Sung M. Kim

That's a clean way to specify redirects :)

I wrote about the same issue and linked yours in case people use netlify.toml.