Search code examples
reduxreact-routergithub-pagesbrowser-history

React/Redux Github pages does not work with browserHistory


I have an react/redux app on Github pages. I used browserHistory from react-router, and the page won't show up with no error messages.

When change from browserHistory to hashHistory, then everything works just fine.

Any reason why this is happening? Could I use browserHistory and still work?

Thanks Leo


Solution

  • Short answer: No.

    In order to use browserHistory you will need a real app server to handle the request and redirect all nont-root level requests back to /. Since GitHub pages is nothing more than a static files host, you can't use browserHistory on it.

    Reference: https://github.com/ReactTraining/react-router/blob/v3/docs/guides/Histories.md#browserhistory