Skip to content

What's the reasoning behind getLayout in _app.tsx? #2866

Answered by flybayer
xkrsz asked this question in Q&A
Discussion options

You must be logged in to vote

Well seems we don't have docs on this, but we should.

The reason is to achieve persisted layouts. Layouts which just wrap each page directly will be unmounted on each page transition.

See more explanation here: https://adamwathan.me/2019/10/17/persistent-layout-patterns-in-nextjs/

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

Answer selected by xkrsz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants