MCPcopy
hub / github.com/TanStack/query / FirstComponent

Function FirstComponent

packages/react-query/src/__tests__/useQuery.test.tsx:1832–1851  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1830 const states: Array<UseQueryResult<number>> = []
1831
1832 function FirstComponent() {
1833 const state = useQuery({
1834 queryKey: key,
1835 queryFn: async () => {
1836 await sleep(10)
1837 return 1
1838 },
1839 notifyOnChangeProps: 'all',
1840 })
1841 const refetch = state.refetch
1842
1843 states.push(state)
1844
1845 return (
1846 <div>
1847 <button onClick={() => refetch()}>refetch</button>
1848 data: {state.data}
1849 </div>
1850 )
1851 }
1852
1853 function SecondComponent() {
1854 useQuery({ queryKey: key, queryFn: () => 2, notifyOnChangeProps: 'all' })

Callers

nothing calls this directly

Calls 3

sleepFunction · 0.90
refetchFunction · 0.85
useQueryFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…