1. It is rendered once on the server - it is the root of your app
  2. App's getInitialProps is called before anything else - even before getInitialProps in _document.js
  3. It is created and mounted ONLY ONCE on the client - when the page first loads. Thereafter, on page navigation, App.getInitialProps is called before each page, and then its render function is called, to render the incoming page.
  4. It lives for the entire lifetime of the clientside app. Unlike pages, it is not unmounted - ever. This makes it a great place to store data that should live for the entire app lifetime.
  5. It sees all of the props passed to every page - and has the chance to modify them.

标签: nextjs

添加新评论