How to conditionally shot Footer and Nav #2206
Replies: 1 comment 2 replies
-
you would not need to repeat those checks in each route. Your root component just needs to render an simple example: function HomePage() {
const showNavAndFooter = true
return (<>
{showNavAndFooter && <NavBar />}
<Outlet />
{showNavAndFooter && <Footer />}
</>)
}
export const Route = createRootRoute({
component: () => <HomePage />,
}); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am tyring to migrate to Tanstack router and have a question.
My current layout looks like below where I show NavBar and Footer conditionally. How would I achieve this in Tanstack Router. I am currently using Filebased routing.
This is my _root file which renders HomePage. I guess I can add the same conditional check as above, but would I have to do this to every single route that requires Nav and Footer?
Is there a way to just do it once like above?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions