Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Support pages/_document as a function component #19355

Closed
timneutkens opened this issue Nov 20, 2020 · 1 comment
Closed

Support pages/_document as a function component #19355

timneutkens opened this issue Nov 20, 2020 · 1 comment
Milestone

Comments

@timneutkens
Copy link
Member

Feature request

Is your feature request related to a problem? Please describe.

Converting _document to a function component has no real benefits currently besides being able to use useContext but there's no context wrapper above _document that you can use with useContext. useState, useEffect, and other hooks will not work as well given that _document is not hydrated client-side.

Even though there are no benefits the question to support a function instead of a class comes up from time to time in #7515, hence why I'm creating this story.

Describe the solution you'd like

_document is currently not a function component for backwards compat reasons, we can likely take a similar approach to what we did for _app though by having getInitialProps fall back to the default value.

@hasanzahran
Copy link

Is there any update regarding this issue.

Thanks

@vercel vercel locked and limited conversation to collaborators Jun 21, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants