How can I fix this error message?
Answered
sh1ro posted this in #help-forum
sh1roOP
Hello, I'm trying to use
next-intl
for multiple language function in my next-app
. I followed the setup on https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#i18n-routing but keep on getting this error message. How should I set up the function to avoid the error?Answered by chisto
in the type it has to be Promise<{ locale: string }>
and you have to await it before using it
const locale = (await params).locale
and you have to await it before using it
const locale = (await params).locale
10 Replies
try
params: Promise<{ locale: string }>
params: Promise<{ locale: string }>
@chisto try
params: Promise<{ locale: string }>
sh1roOP
In the type or in the function?
in the type it has to be Promise<{ locale: string }>
and you have to await it before using it
const locale = (await params).locale
and you have to await it before using it
const locale = (await params).locale
Answer
sh1roOP
Okay, lemme try!
Asian black bear
I just opened an issue on GitHub to update the docs: https://github.com/amannn/next-intl/issues/1587
And can confirm that chisto is right in what you have to do since this is a new change introduced in Next 15 wherein params are asynchronous.
@Asian black bear I just opened an issue on GitHub to update the docs: https://github.com/amannn/next-intl/issues/1587
sh1roOP
It's working now. Thanks a lot.
How can I close this help now?
Asian black bear
I did.