Skip to content
Discussion options

You must be logged in to vote

It's not possible to break outside of the custom _app.js file since it, by design, is supposed to wrap all client-side pages. That said, you can break outside of the div.__next element by using createPortal. However, there are two drawbacks:

1.) Limited to CSR
2.) Technically still wrapped by the _app, but you'll lay over it using CSS (position: absolute; top: 0;). As such, you'll also have to provide some CSS hacks to not display the _app's layout when the page is SSR'd.

See demo repo here for creating portals.


A significantly better approach (also included in the demo repo above) would be to wrap individual pages with a reusable Layout component. If any of the pages required different …

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@5ervant
Comment options

@IamLizu
Comment options

@IamLizu
Comment options

Comment options

You must be logged in to vote
1 reply
@IamLizu
Comment options

Answer selected by 5ervant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants