I have gone through lot of similar questions in stack overflow like this one. Each one have different perspective of deploying the react app.
But this question is fo
If there is anyone who stumbles into this post, and the solution doesn't work because of a infinite loop in the history.listen function; For me the solution was to add a small timeout for the history.replace(path) call. So it looks like this:
history.listen(location => {
const path = (/#!(\/.*)$/.exec(location.hash) || [])[1];
if (path) {
setTimeout(() => {
history.replace(path);
}, 100);
}
});