![]() So to fix your site on Heroku hosting add a file called “static.json” to your root folder (next to packages.json) with the following configuration. The default root document in create-react-app aps is index.html Is react router is static or dynamic Before the. The heroku build pack deploys your site on heroku as a static react application so you have to tell heroku that for ALL routes, it should just go to your root/index document so react-router can handle the application routing. React router is a routing library built on top of the react which is used to create the routing in react apps. If you use react router you will get a 404 from nginx when you try to directly open a route. ![]() This is magic but there is still some configuration needed on your application for routing. You can basically deploy in 2 minutes.Īssuming you have the heroku command line tool already configured the following gist describes the commands to setup the build pack: The community have put together a build pack for create-react-app. I’ve been putting together a React app and I needed cheap, fast hosting so I went to put it on Heroku. Follow me on twitter for more posts like this
0 Comments
Leave a Reply. |