NextJsCustom App and Document

Customize the default App and Document to modify how pages are rendered. _app.js wraps all pages, and _document.js customizes the HTML document structure.

pages/_app.js
export default function MyApp({ Component, pageProps }) {
  return <Component {...pageProps} />;
}

pages/_document.js
import { Html, Head, Main, NextScript } from 'next/document';

export default function Document() {
  return (
    <Html>
      <Head />
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  );
}