Next.js Discord

Discord Forum

sidebar trick and routing

Answered
Polar bear posted this in #help-forum
Open in Discord
Original message was deleted.
Answered by B33fb0n3
Hmm I think I should've specified that my issue is with how to create the layout.

I don't think you need a layout here, because both are very different pages. So I would work with just two different components
View full answer

3 Replies

Original message was deleted
you can do that by creating two different component and reusing the components for the stuff that already exists.

When on mobile, render a "MobileScreen" componet (for example) and on large screens render a "LargeScreen" component.

Instead of then rewriting all the functionalities for each and every page, extract the specific parts to their own components so you can reuse them where needed.

Like that you can easily change the displaying of it, but keep the functionality the same
Original message was deleted
Hmm I think I should've specified that my issue is with how to create the layout.

I don't think you need a layout here, because both are very different pages. So I would work with just two different components
Answer
happy to help