Replies: 1 comment 2 replies
-
Not sure if I understand you correctly. If you'd add a code example of what you have and would like it might make it easier. Maybe you can pick up ideas from my current setup (simplified and untested): export default function() {
const Main = (props) => {
return (<>
<Header/>
{props.children}
<Footer/>
</>)
}
const Routes = () => <Router root={Main}><Pages/></Router>
render(Routes, document.getElementById("main"))
} The export default function Pages() {
return (<>
<Route path="/" component={Home} />
<Route path="/test" component={Test} />
</>)
} The DOM then would look something like this: <body>
<div id="main">
<header></header>
<div class="home"></div>
<footer></footer>
</div>
</body> Edit: Upon reading you question multiple times I think you mean to adjust e.g. the In that case you could use import { useLocation } from "@solidjs/router"
const location = useLocation()
const pathname = location.pathname |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am wondering if there is an elegant way to customize the layout component passed as
root
prop toRouter
depending on whichRoute
is active.It feels very natural to me that some component (its markup) e.g. header repeats over all pages, but for one attribute, so I may place it in the layout component and access router state/definition to set customizable prop. Still, I don't see a solution for that on current solid-router version.
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions