0

So my app, /portfolio, works fine when deployed to the normal github hosting. You can see that here. But when I switch to a custom domain the app doesn't want to mount. I did a bit of research and assumed it has to do with react-router but I can't seem to figure it out.

Heres my BrowserRouter code:

<BrowserRouter basename={process.env.PUBLIC_URL}>
  <App />
</BrowserRouter>,

Which leaders to /portolio/ as the basename. I assume it should correctly change when on the custom domain but I played with it to no effect.

Any hints on what could be going wrong?

1 Answer 1

1

Turns out create-react-app docs actually highlight this problem. Github pages doesn't play well with BrowserRouter. Theres a sort of hack in the documents here that worked swimmingly for me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.