spa-github-pages icon indicating copy to clipboard operation
spa-github-pages copied to clipboard

React-router params

Open keyofevergreen opened this issue 3 years ago • 2 comments

Hello! I keep id in router params. And when the page is reloaded, a request is made to the server for this id

But for some reason, nothing happens to me instead and it seems that the whole application crashes (white screen, 404 errors in the console)

I don't understand what's wrong. Didn't find a solution..

keyofevergreen avatar Mar 16 '22 18:03 keyofevergreen

I have the same problem using React BrowserRouter with useParams(). Did anyone find a solution for this yet?

Jasperhino avatar Jul 04 '22 08:07 Jasperhino

I just solved it, the problem was, that the app was looking for owner.github.io/assets/index.js instead of owner.github.io/repo/assets/index.js. I solved this by adding base: '/repo/' in my vite.config.js.

Jasperhino avatar Jul 04 '22 09:07 Jasperhino