Next.js Discord

Discord Forum

Hidratation problem with Internacionalization

Answered
JChicano posted this in #help-forum
Open in Discord
I followed the documentation of next (without installing libraries), and i have the layout like the image, the web is working well but i have this problem
Answered by joulev
ah yeah the issue is here
View full answer

22 Replies

The problem is that the component renders gives a 404 error and then loads the language and works correctly, this causes a hydration error, so I want to know if the parameters that I am passing to the component and the form are appropriate or not, since I don't really know if you have to do an await or a promise or whatever
and the steps to reproduce this bug
@joulev the code here looks fine... can you make a minimal reproduction repository?
i think that the problems can be in this two files
no... they look fine to me
it can be here?
bcs its diferent than the layout
the way to obtein the params*
it looks good as well
this is the warning that throws
@JChicano Click to see attachment
ah yeah the issue is here
Answer
@JChicano Click to see attachment
yeah exactly
And how should I put it?
yeah just do const { lang } = await params at the top and use lang
like i have in the normal page
ye, its solved
:lolsob:
or this pattern which i prefer:

instead of
function Page({ params }) {
  const lang = (await params).lang;
}

you'd do
function Page(props) {
  const params = await props.params;
  // use params.lang here
}