Use React Query hooks to call server actions in client components?
Answered
South Polar Skua posted this in #help-forum
South Polar SkuaOP
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?
Answered by B33fb0n3
there aren't any for me know security concerns. Yes you can fetch data via server actions, but you shouldn't because some disadvantages.
You want to fetch a route handler to keep prevent them. You also want to fetch data server side and pass them as props to the client component.
You want to fetch a route handler to keep prevent them. You also want to fetch data server side and pass them as props to the client component.
2 Replies
@South Polar Skua 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?
there aren't any for me know security concerns. Yes you can fetch data via server actions, but you shouldn't because some disadvantages.
You want to fetch a route handler to keep prevent them. You also want to fetch data server side and pass them as props to the client component.
You want to fetch a route handler to keep prevent them. You also want to fetch data server side and pass them as props to the client component.
Answer