next-intl: import is not working
Answered
Giant panda posted this in #help-forum
Giant pandaOP
20 Replies
Giant pandaOP
Everything works but when im trying to import
import {useTranslations} from 'next-intl'; it does not work and gives me that errorim doing exactly the same what the docs say
I think it is because you use it on client side
do you have
'use client' on top of the file@Ray can you show the code of this page?
Giant pandaOP
@Giant panda Click to see attachment
is his parent a client component?
@Ray is his parent a client component?
Giant pandaOP
yep
oh it makes Hero to be a client component too
Giant pandaOP
yea
that's why it not working
Giant pandaOP
damn i need it tho
for the icon libary
can you render this in children of its parent
Giant pandaOP
nop
is there no way around?
Answer
the doc provide 4 options to you
@Ray https://next-intl-docs.vercel.app/docs/environments/server-client-components#option-1-passing-translations-to-client-components
Giant pandaOP
yep works thank you