Next.js Discord

Discord Forum

SWR in appDir in React Server Component

Answered
Petit Bleu de Gascogne posted this in #help-forum
Open in Discord
Petit Bleu de GascogneOP
Is there any way to use SWR in React Server Component in app directory?
Answered by B33fb0n3
because npm swr is a library, you can use it only clientside. If you want to use the features of swr like caching, you can do this by using default fetching methods provided inside the nextjs docs
View full answer

3 Replies

because npm swr is a library, you can use it only clientside. If you want to use the features of swr like caching, you can do this by using default fetching methods provided inside the nextjs docs
Answer
@Petit Bleu de Gascogne solved?
Petit Bleu de GascogneOP
Understood, thanks @B33fb0n3 a lot