Use React Query hooks to call server actions in Next.js 14 client components?
Is it considered good practice to use React Query hooks to call server actions in Next.js 14 client components? Are there any security concerns for fetching data this way?
1 Reply
like-gold•12mo ago
Yes, you can use server actions on useMutation but don’t use them with useQuery.
Server actions creates an api endpoint under the hood so be careful with what you put inside it.