Replies: 3 comments 1 reply
-
Then you need a different API for fetching data in server components. |
Beta Was this translation helpful? Give feedback.
-
SWR can't run on the server side (e.g. during SSR), that's the case from the beginning. And server components won't be hydrated on the client, so everything inside them will not run on the browser. One way to think about it is that you can't run |
Beta Was this translation helpful? Give feedback.
-
Almost a year old, but I figured to comment, because I was confused about how |
Beta Was this translation helpful? Give feedback.
-
SWR is highly depending on client React features like state, context, effect, etc. so it can't be used in server components. The best way to avoid this is to add a
"client-only"
import to the core.Beta Was this translation helpful? Give feedback.
All reactions