Update custom document docs to prepare for React 18. (#33814)
To help prepare for React 18, I've found myself sharing the updated code snippet of `_document` linked in the [React 18 docs](https://nextjs.org/docs/advanced-features/react-18#react-server-components), which uses a function instead of a class. This PR updates the Custom Document docs to help prepare for this change, by encourage readers to use the new version, and listing more tangible examples of why you would override `_document` (`lang` on `html`, className on `body`). It also reorganizes some of the caveats and warnings related to `getInitialProps` usage to only be in the single section that applies to it. These overrides and ejections (`getInitialProps` and `renderPage`) only apply to a subset of the people looking to change document. Co-authored-by:JJ Kasper <22380829+ijjk@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment