How on earth does the createNavigation() function work? #1812
Replies: 1 comment 2 replies
-
😅 Glad you're asking! The way this works in next-intl/packages/next-intl/package.json Lines 64 to 69 in 1e74950 While all APIs are available in Client Components, in Server Components some APIs are replaced with functions that will throw if invoked by accident: This allows to have In consuming apps, in case you want to create your own navigation APIs, I'd suggest to not use the factory pattern, but to create your navigation APIs in distinct files (e.g. |
Beta Was this translation helpful? Give feedback.
-
If you refer to the code, it exports hooks like useRouter, which cannot be used on the server, along with the Link component. However, even when importing the Link component in a server component, no error occurs.
However, when I write code with a similar structure within the project and only import the Link component, I encounter an error like the one below.
Beta Was this translation helpful? Give feedback.
All reactions