Replies: 3 comments 1 reply
-
Hi @dalelotts! I'm definitely open to a pull request for this. It's hard to know what you're trying to change without a diff. I think what you're suggesting is a good thing though. Thanks! |
Beta Was this translation helpful? Give feedback.
-
What I typically do when I have a single route that needs a custom layout, but don't want to introduce an extra folder is to export the custom layout via Create a default layout at your root/parent route. Then in a child route, simply export the new layout. // root.tsx
function DefaultLayout() {
return (
<div>
<h1>Default Layout</h1>
<Outlet />
</div>
)
}
export function Layout() {
const matches = useMatches()
return matches.find(m => m.handle?.layout)?.handle?.layout ?? DefaultLayout
} // routes/some-route.tsx
export const handle = {
layout: CustomLayout
}
function CustomLayout() {
return (
<div>
<h1>Custom Layout</h1>
<Outlet />
</div>
)
}
export function Component() {
return <div>Child Route</div>
} |
Beta Was this translation helpful? Give feedback.
-
Routing in Remix will have a major overhaul where it will be done programmatically |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When creating an app that has a layout variation on one route, I ended up having to have multiple copies of _layout.tsx in multiple folders (symlinks would not work as the real path is resolved) for multiple reasons.
Perhaps /routes could look a bit more like the following to make it trivial to update the layout and app specific content while still pulling in changes from this repo. (see the legal-notice and uses-different-layout routes)
Then remove all layout from root.tsx and perhaps add a cookie consent
Beta Was this translation helpful? Give feedback.
All reactions