How can I specify <Router /> basename?
See original GitHub issueHow can I specify a router basename?
With the <BrowserRouter />
component in react-router v4, there is a basename prop:
<BrowserRouter basename="/calendar" />
<Link to="/today"/> // renders <a href="/calendar/today">
Is there a way to access or use this in the <Router /> component provided in mirrorx?
import mirror, {Router, render} from 'mirrorx'
render((
<Router basename="/calendar"> // no basename prop... this doesn't work
...
</Router>
), document.getElementById('foo'));
thanks! 😄
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Configuring app's basename in react-router - Stack Overflow
The basename comes into play in several places: static asset compilation in Webpack; react-router main configuration; specifying redirect routes ...
Read more >basename prop - React Router Quick Start Guide [Book]
basename prop The basename prop is used to provide a base URL path for all the locations in the application. For example, if...
Read more >BrowserRouter - React Router: Declarative Routing for React.js
basename : string. The base URL for all locations. If your app is served from a sub-directory on your server, you'll want to...
Read more >[Bug]: v6 BrowserRouter set basename, not match “/” #8427
This is the expected behavior. You need to include the basename in the URL for the page itself for the Router to match...
Read more >Add a Base URL to an App Using Redux and React Router
Adding basename in the BrowserRouter component ensures that all the links in the routes are prefixed with the base URL.
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 Free
Top 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
@blairbodnar you could pass an
history
instance toRouter
function:Yeah, that’s a problem currently, 'cause the
ConnectedRouter
provided by react-router-redux is a top-level Router which doesn’t handle props likebasename
orgetUserConfirmation
.We’ll figure out this, thanks for response!