Next.js Discord

Discord Forum

How do you handle different page "layout (and actions)" for a specific component in the page?

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
I am building on next.js 13 and I came up with a particular problem that bugged for a while and wondered what would be the proper way to tackle it. So all my users are registered and each one of the have a different role. But all can interact with the same page but they won't be shown the same page (here it will be only a button label and action trigger (that would be different in a component). And I was wondering what is the best way to handle such behavior? Should I create a new component for each type of user that will handle it on its own? How would you achieve this? Thank you

5 Replies

Brown bearOP
If I put the role in the header of the component, what will be the use of it since the component is the one that determines the what to display?
Or if you put the role inside a session object you can check that to conditionally render the components