basePath not working on top level component
See original GitHub issueHello,
First - thanks for this nice library. I have s one struggle. In hookrouter you can use setPath function on start application (https://github.com/Paratron/hookrouter/blob/master/src-docs/pages/en/05_serverside-rendering.md#setting-the-path)
I have react application which is serving in subofolder - for example (www.sampleapp.com/subfolder/sampleapp.
In top level component i have define routes:
const route = useRoutes(AppRoutes, { basePath: "sampleapp" });
But this is not working.
Is there any workaround, how i use basePath(setPath) for this usecase?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to fix Blazor WASM base path problems - elmah.io Blog
This post will show you how to fix a common problem when setting the application base path with Blazor WebAssembly.
Read more >Better `basePath` support · Issue #914 · loopbackio/loopback ...
Currently, you can set a spec.basePath at the top-level of your spec, but it does not cascade down as expected to all the...
Read more >Next.js basePath not working for assets : r/reactjs - Reddit
I'm working on a little internal utility app for my self at work that doubles as a proof-of-concept for Next.js for use in...
Read more >How to change basepath on deployment of Vue app
This has recently been a problem for me. And the above solutions did not work. The below solution works for vue 2.6 ,...
Read more >Deploy your NextJS Application on a different base path (i.e. ...
Build a Multi-Container Docker Application with Docker Compose with a React, Node, and Postgres App.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice, this is exactly my use case and it works!
Thanks for the help.
This is because the
<Link>
s in the app render are outside of theuseRoutes
result, so they can’t inherit thebasePath
from it. ThebasePath
is only provided to components rendered byuseRoutes
. Does that make sense?You can provide the
basePath
to the<Link>
, or you can create a wrapped version of the<Link>
that has its ownbasePath
defined.Check out this example