Query hook pattern
export const useProjects = () =>
useQuery({
queryKey: ["projects"],
queryFn: fetchProjects,
staleTime: 30_000,
});Mutation flow
For create/update/delete actions, invalidate only the affected query keys. This keeps UI fresh without excessive refetching.
