Tanstack with next server action
Hey everyone!
I’m using TanStack Query + Next.js and want to make sure I’m doing this the best way.
Here’s what I’m doing:
✅ I have a server action like:
✅ On the client side, I call it using:
And trigger it with a button:
🔧 My questions:
✅ Is this the right or best practice way to call server actions in a client component?
✅ Any tips for better error handling or optimistic updates here?
0 Replies