tanstack-query-intent-compositions-query-data-and-forms

Installation
SKILL.md

Core Patterns

Treat form state as client state after the user starts editing. Server state can initialize the form, but it should not be copied blindly on every query update.

Initial data only

Use this when one user owns the form and background updates are not useful while editing.

import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'

function PersonDetail({ id }: { id: string }) {
  const queryClient = useQueryClient()
  const person = useQuery({
    queryKey: ['person', id],
    queryFn: () => fetchPerson(id),
    staleTime: Infinity,
  })
Installs
3
First Seen
Aug 10, 2026