Nested Layouts for routes
See original GitHub issueI love the boilerplate but am having issues having nested layouts for instances
export default (
<Route path='/' component={BaseLayout}>
<Route path='auth' component={Auth} />
<Route component={AuthenticatedLayout}>
<Route path="dashboard" component={Dashboard} />
<Route path='Inbox' component={Inbox} />
</Route>
</Route>
)
In this instance, you can see that the authenticated routes have another layout applied to it. But this boilerplate defines a different way to construct your routes such as
export default function createRoutes (store) {
return {
path: 'posts',
getComponents (location, cb) {
require.ensure([
'./containers/PostList',
'./reducer'
], (require) => {
let PostPage = require('./containers/PostList').default
let postReducer = require('./reducer').default
injectAsyncReducer(store, 'posts', postReducer)
cb(null, PostPage)
})
}
}
}
So I would love assistance on this topic!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Deeply Nested Layouts in Next.js - Medium
So, to recap, we have 3 levels of shared layout: header and footer at root-level (all routes below / , inclusive); teams-level sidebar...
Read more >Blog - Layouts RFC | Next.js
Nested Layouts : Build complex applications with nested routes. Designed for Server Components: Optimized for subtree navigation.
Read more >React Router and nested routes - Kevin Farrugia
In my own words, a nested route is a region within a page layout that responds to route changes. For example, in a...
Read more >Next.js on Twitter: "3/ Layouts can be nested and shared ...
3/ Layouts can be nested and shared across routes. On navigation, layouts do not re-render, meaning they preserve state and remain ...
Read more >File-based routing with React Location — Nested layouts
In the previous post, the implementation of the routes definition was resulting in a flat array with one entry for each route. To...
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
I managed to get this working today, do you want me to post my findings ?
@lewis-elliott yes!