Passing down data from _document into a context provider #11772
Unanswered
kevinvdburgt
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We're building a multi language website using NextJS, but instead of choosing the language based on routing (ex; http://localhost/en/blog, http://localhost/de/blog) we have multiple domain extensions (ex; http://domain.com/blog, http://domain.de/blog). The _document is aware of the language to use by a helper function that checks the content of
ctx.req.headers.hostin thestatic async getInitialPropsfunction. We pass that down to the render function:Now the question is, how do we pass down that
languageprop down to our _app's LanguageContext provider so we can use our translation hooks without breaking SSR?Beta Was this translation helpful? Give feedback.
All reactions