Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom document docs to prepare for React 18. #33814

Merged
merged 5 commits into from Feb 3, 2022

Conversation

leerob
Copy link
Member

@leerob leerob commented Jan 30, 2022

To help prepare for React 18, I've found myself sharing the updated code snippet of _document linked in the React 18 docs, 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.

ijjk
ijjk previously approved these changes Feb 3, 2022
@kodiakhq kodiakhq bot merged commit 5abd92f into canary Feb 3, 2022
@kodiakhq kodiakhq bot deleted the react-18-document-docs branch February 3, 2022 18:35
natew pushed a commit to natew/next.js that referenced this pull request Feb 16, 2022
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>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
created-by: Next.js team PRs by the Next.js team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants