Improve Document Component Error (#17047)
This commit is contained in:
parent
d113c640b3
commit
9adf3bb637
1 changed files with 26 additions and 1 deletions
|
@ -6,7 +6,32 @@ In your custom `pages/_document` an expected sub-component was not rendered.
|
|||
|
||||
#### Possible Ways to Fix It
|
||||
|
||||
Make sure to import and render all of the expected `Document` components.
|
||||
Make sure to import and render all of the expected `Document` components:
|
||||
|
||||
- `<Html />`
|
||||
- `<Head />`
|
||||
- `<Main />`
|
||||
- `<NextScript />`
|
||||
|
||||
For example:
|
||||
|
||||
```tsx
|
||||
import Document, { Html, Head, Main, NextScript } from 'next/document'
|
||||
|
||||
export default class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
<Html>
|
||||
<Head />
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Useful Links
|
||||
|
||||
|
|
Loading…
Reference in a new issue