Currently, this is what I have in my _document.tsx file:
import Document, { Html, Head, Main, NextScript } from 'next/document';
class CustomDocument extends Document {
return = (): JSX.Element => (
<Html lang="en-US">
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
However, an error is being thrown:
Syntax error: Unexpected token
2 |
3 | class CustomDocument extends Document {
> 4 | return = (): JSX.Element => (
The error message specifically points to the letter E in Element.
Here are the listed dependencies:
"@babel/core": "^7.17.9",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/runtime": "^7.17.9",
"next": "^12.1.5",
"react": "17.0.2",
"react-dom": "17.0.2",
"sass": "^1.35.1"