Data fetching in client components, Next 13+
TRPC support for /app is not ready yet (from what I've seen).
Server Actions seem to be more mutation focused, Zact seems to be heading that way too. Although I guess you could use SA to fetch data.
So what now? Use the good old API routes and React Query?
4 Replies
yep
This video covers how to set up React Query to work with the /app dir and server components: https://youtu.be/-z0LQRwbS0Q
Jack's Codding Arsenal
YouTube
NextJs 13.4 With React Query And App Router
Don't forget to like and subscribe.
Code for the project in the video: https://github.com/MariusParasca/nextjs-tutorials/tree/react-query-prefetching
NextJs 13.4 and React Query Prefetching: https://youtu.be/pH9-KFWteRs
Also, here is an article that covers pretty much the same setup: https://codevoweb.com/setup-react-query-in-nextjs-13-app-directory/
Edem
CodevoWeb
How to Setup React Query in Next.js 13 App Directory - CodevoWeb
Are you interested in using React Query in your Next.js 13 app directory? If so, you’ve come to the right place! In this article, I’ll...
For now im using react query + zod