score:5

Accepted answer

as i understand, once you have opened the app in your browser, any changes to the url will not be requested from the server but instead handled client-side in react router, even if you reload the page or write something manually into the address bar.

this is not true. upon manual change in address bar (and pressing enter), you will always first hit server router.

it is very likely that your server, no matter which url is hit, will always render your index.html which contains your react app. something similar to this:

app.use(express.static(path.join(__dirname, 'dist')));
app.get('*', function(req, res) {
    res.sendfile('./dist/index.html');
});

make sure your api requests do not conflict with this. if possible, share some code, so we can review what could go wrong.


Related Query

More Query from same tag