Hi there,
I've come across an issue which I've been trying to figure whether I'm just doing something wrong or whether it's an actual bug. After a lot of searching here, on stackoverflow and google, I still can't figure out if I'm doing something wrong or if I've found an actual problem.
Part of the reason as to why I'm so confused is also because I found the intersection between react-router and history a bit confusing. It took me a while to figure out exactly how to use history's enhancer functions with react-router and I still think the issue might lay there.
In any case, here's the issue:
2.0.0
https://github.com/trodrigues/react-router-basename-test
http://trodrigues.github.io/react-router-basename-test/
Click the button, which uses this.context.router.push to navigate to /content/path
Should navigate to http://trodrigues.github.io/react-router-basename-test/content/path
Navigates to http://trodrigues.github.io/react-router-basename-test/react-router-basename-test/content/path
If I use the <base> tag instead of the useBasename enhancer this works fine. However, given that I have a slightly different setup for dev and production, using an environment variable to define the basepath would be more helpful, rather than manipulating the <base> tag at build time.
Let me know if I can provide any further detail.
After doing some more investigation into this I found that useRouterHistory already uses the same enhancer I'm trying to use here. I'll make a PR trying to document this as I definitely wasn't expecting that to happen.
Me and my peer-programming buddy now officially love you! :heart:
(Kind of got stuck here for a long time)
Most helpful comment
After doing some more investigation into this I found that
useRouterHistoryalready uses the same enhancer I'm trying to use here. I'll make a PR trying to document this as I definitely wasn't expecting that to happen.