Commit d10d80ce authored by Alexander Ryzhikov's avatar Alexander Ryzhikov Committed by Arunoda Susiripala

Fix react-helmet example missing initial props (#1598)

* Fix react-helmet example missing initial props

* Fix semicolon
parent 7f059189
...@@ -2,10 +2,11 @@ import Document, { Head, Main, NextScript } from 'next/document' ...@@ -2,10 +2,11 @@ import Document, { Head, Main, NextScript } from 'next/document'
import Helmet from 'react-helmet' import Helmet from 'react-helmet'
export default class extends Document { export default class extends Document {
static async getInitialProps ({ renderPage }) { static async getInitialProps (...args) {
const documentProps = await super.getInitialProps(...args)
// see https://github.com/nfl/react-helmet#server-usage for more information // see https://github.com/nfl/react-helmet#server-usage for more information
// 'head' was occupied by 'renderPage().head', we cannot use it // 'head' was occupied by 'renderPage().head', we cannot use it
return { ...renderPage(), helmet: Helmet.rewind() } return { ...documentProps, helmet: Helmet.rewind() }
} }
// should render on <html> // should render on <html>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment