#TanStack Query and Next.js with REST API (data fetching preference)

10 messages · Page 1 of 1 (latest)

ember solstice
#

Still new to Next.js.
The web application will instead have a REST API for the actual backend stuff,
According to the moderator, if I will fetch via REST API, it is better to use stuff like TanStack query instead of server actions.
This weekend I went over the docs of TanStackQuery.
Which is the preferred way or the recommended way for Next.js + TanStack Query in this case?
Prefetching (https://tanstack.com/query/latest/docs/framework/react/examples/nextjs-app-prefetching) or streaming (https://tanstack.com/query/latest/docs/framework/react/examples/nextjs-suspense-streaming) ?

weary fieldBOT
#

🔎 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)

ember solstice
#

TanStack Query and Next.js with REST API (data fetching preference)

prime sapphire
ember solstice
#

Additional question, if I will use React Query, is it okay to use axios or should I use fetch?
Based from what I heard, next.js enhanced the default fetch and it is better to use it when using next.js

prime sapphire
prime sapphire
ember solstice
#

I see, I didn't know.
Thank you very much!

weary fieldBOT