I thought I was starting to understand React Router, but I hit a new wall when adding a library that loads css for its components. Everything works fine when a navigate from
I solved this thanks to react-script:2+
You just have to create a js file called setupProxy.js, it will be loaded by the developement server. Now you have complete control over your proxy:
const proxy = require('http-proxy-middleware');
module.exports = function(app) {
console.log("configuring development proxies to point to localhost:4000")
app.use(proxy('/api', { target: 'http://localhost:4000/' }));
app.use(proxy('/graphql', { target: 'http://localhost:4000/' }));
};
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#configuring-the-proxy-manually