Next.js Discord

Discord Forum

view depending on url?

Answered
Acacia-ants posted this in #help-forum
Open in Discord
Original message was deleted.
Answered by Common House-Martin
I would put the slug query in the layout and make the other pages client side and then you can pass it through usecontext
View full answer

3 Replies

Common House-Martin
why do you need to use usestate just get the the slug and render accordingly?
Original message was deleted
use nested route
detail/[slug]/layout.tsx
detail/[slug]/context/page.tsx
detail/[slug]/upcoming-events/page.tsx
Common House-Martin
I would put the slug query in the layout and make the other pages client side and then you can pass it through usecontext
Answer