Netlify and React Router

Sven Schannak
1 min readJan 22, 2019

Netlify is a really easy way to deploy your React apps. All you have to do is just to execute “netlify deploy — dir=./build” and your app will be deployed. There is just one problem you have to handle, if you want to use react-router. Because react-router and netlify don’t work together out of the box.

Gladly, the solution is pretty simple. You just have to add a file called “_redirects” to your “public” folder, or the folder you have specified where your index.html file is located. In this file you just have to paste the following code:

And that’s it. After you have redeployed your app, everything should work as expected.

--

--