For Example: If I want to have two different types of Nav-Bars for the Shopping area & User settings area.
You can use pages/_app.js
to share a layout across all pages, but if you have multiple layouts, you could either:
_app.js
. For example, pages/index.js
would render your <Layout />
component there instead of in _app.js
. Then, pages/blog.js
could render a different layout <BlogLayout />
.useRouter()
hook inside _app.js
to check which route you're on and conditionally change the layout.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With