Today I learnt that not only can I pass Next.js server action as a fetch function into react query (so it's not just for mutation), but a React Server Component can also be a server action too. Now I want to try this out to see how implementing infinite scrolling will feel with this approach.
The documentation for next's server action is quite lacking imo, but I am quite impressed with the tech itself
#react #nextjs #servercomponents #webdev

Source (nitter link to avoid going to birdsite): https://nitter.net/Riyaadh_Abr/status/1681336073119490048

Now i have to wonder, since server components can import client components, is the same true for server actions?

Riyaadh Abrahams (@Riyaadh_Abr)

I discovered a cool thing about React Server components. Why does this work? 🤯 🔸Create NextJS 13 async component. 🔸Add "use server" to the top of the file 🔸Import into client component 🔸Resolve it using react-query by @TkDodo 🔸Render it in client component I know we probably should not do this, but its amazing that it works #buildinpublic

Nitter