question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested Layouts for routes

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Jan 26, 2017

I managed to get this working today, do you want me to post my findings ?

0reactions
alex-aldcommented, Jan 26, 2017
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found