nested custom routing
See original GitHub issueUsing custom routing nested Route:
App.js
<Router>
<div className="App-menu">
<Link to='/en/works'>Works</Link>
<Link to='/en/about'>About</Link>
<Link to='/en/events'>Events</Link>
</div>
<div className="App-right">
<Switch>
<Route path="/" exact render={() => null} />
<Route path={`/:lang/about`} render={() => <About lang={lang} />} />
<Route path={`/:lang/events`} render={() => <Events lang={lang} />} />
<Route path={`/:lang/works`} render={() => <WorkList lang={lang} />} />
</Switch>
</div>
</Router>
WorkList.js
<div>
<div className="works-menu">
<Link to={`/en/works/work1`}>work1</Link>
<Link to={`/en/works/work2`}>work2</Link>
<Link to={`/en/works/work3`}>work3</Link>
</div>
<Route path={`/:lang/works/:name`} render={() => <Work lang={lang} />} />
</div>
It works if I go directly (full page refresh) to /en/works/work1
. However I get an error if I do a menu click on one of <Link to={'/en/works/work1'}>work1</Link>
.
I have all the route in my static config:
return [
{
path: '/',
},
{
path: `/en/works/work1`,
getProps: () => ({
data: work1,
}),
},
etc..
];
Also tried having children
property in static config. The same output:
Warning: getRouteProps could not find any props for route: /en/works/stone-water-sting. Either you are missing a getProps function for this route in your static.config.js or you are using the getRouteProps HOC when you don't need to.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
The Guide to Nested Routes with React Router - ui.dev
In this comprehensive, up-to-date guide, you'll learn everything you need to know about creating nested routes with React Router.
Read more >rails routes and custom routing for nested resource
For several projects I need something to simplify my routes to remove the controller name for one of the most important routes.
Read more >Nested Routing in react-router-dom - DEV Community
Nested routing is the act of "burying" routes inside each other. ... Lets start by creating a custom component to store the routing...
Read more >Adding Nested Routes - Tutorial - Ember Guides
The index nested route is shown by default when the user visits the rentals ... route's path by specifying this.route('index', { path: '/custom-path'})...
Read more >Nested routings and Custom Data - SAP Community
Hi, I am working and testing different solutions with Nested Routings. For normal operations in a routing I can add Custom Data for...
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
Upgrade to the patch I just released (
4.8.5
) and it should be fixed 😃Awesome!