1

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'?

신원세
  • 11
  • 1
  • 1
    That's because `useTranslations` is not really a hook (in the typical sense) - it doesn't use `useEffect` or `useContext` internally. It uses the `use` "hook" which can be used in RSCs. – juliomalves Jul 07 '23 at 00:19

0 Answers0