Open mariabarkouzou opened 2 years ago
I've created the _document.js as suggested in the template but I get this error in the console:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
The code is this:
import React from 'react' import Document, {Html, Head, Main, NextScript} from 'next/document' import client from '../client'
export default class MyDocument extends Document { static async getInitialProps (ctx) { const initialProps = await Document.getInitialProps(ctx) return client.fetch('*[_id == "global-config"] {lang}.lang[0]').then(lang => { return {...initialProps, lang} }) }
render () { return (
<Html lang={this.props.lang || 'en'}> <Head /> <body> <Main /> <NextScript /> </body> </Html> )
} }
Has anyone had this issue?And if yes , how did you solve it?Thank you in advance!
I've created the _document.js as suggested in the template but I get this error in the console:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
The code is this:
import React from 'react' import Document, {Html, Head, Main, NextScript} from 'next/document' import client from '../client'
export default class MyDocument extends Document { static async getInitialProps (ctx) { const initialProps = await Document.getInitialProps(ctx) return client.fetch('*[_id == "global-config"] {lang}.lang[0]').then(lang => { return {...initialProps, lang} }) }
render () { return (
} }
Has anyone had this issue?And if yes , how did you solve it?Thank you in advance!