#Question about _app.js

5 messages · Page 1 of 1 (latest)

spare surge
#

I am doing the next.js tutorial, and I was wondering if _app.js wraps every component individually or does it wrap each page as a whole or both?

lament tapir
#

it wraps the whole app just once

#

it is basically doing this:

<App>
  <CurrentPage />
</App>
#

so when you navigate pages using next/link, the App component remains the same and only the page is rerendered

#

this is why its recommended to store app-level state in _app, so it isn't lost when changing pages