-
I am trying to use next.js app router with next-intl package. On next-intl document, they show a example that use hooks on server components. https://next-intl-docs.vercel.app/docs/environments/server-client-components I have been known that I can't use hooks on server components, but how can I use useTranslations on server components. I saw next-intl's source code, but they use 'useMemo' and 'useContext' inside useTranslations. What is different point between normal hooks like 'useState' or 'useEffect' and 'useTranslations' from 'next-intl'? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hope this helps! |
Beta Was this translation helpful? Give feedback.
next-intl
uses thereact-server
conditional export, that's how we can fork the implementation based on the environment of the compilation: https://github.com/amannn/next-intl/blob/feat/next-13-rsc/packages/next-intl/package.json#L24-L26Hope this helps!