#React Query or SWR with next js 13 or another?

7 messages · Page 1 of 1 (latest)

rancid kite
#

Hello, I'm trying to learn React Query with Next JS 13, but it's a bit hard.

Is React Query the best way to work with fetch and fetching data with client and server components, so it will update in realtime from database to the site directly?

Or how do you guys work?

hexed widgetBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

dry ruin
#

It's not related to using Next 13 or not, as using SWR or React Query is traditionnal SPA pattern. You have client-side code that sends requests to API. What Next 13 brings is the possibility to do the same in a "server component" that is basically a very smart HTML template.

#

The point of SWR or React Query is to manage complex stuff like caching for you client-side

#

which is best is up to you, I am totally fine with SWR that I find simple but smart enough.

#

Haven't had the chance to use React Query, it feels like a huge beast.

#

Some of those libraries support server-side rendering, meaning that in a Client Component, which is rendered both on the server and the client (their name is bad 🤷 ), some lib can fetch data during the server render, some only during the client render