MCPcopy Create free account
hub / github.com/TanStack/query / FirstComponent

Function FirstComponent

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

Source from the content-addressed store, hash-verified

1812 const states: Array<UseQueryResult<number>> = []
1813
1814 function FirstComponent() {
1815 const state = useQuery({
1816 queryKey: key,
1817 queryFn: () => sleep(10).then(() => 1),
1818 notifyOnChangeProps: 'all',
1819 })
1820 const refetch = state.refetch
1821
1822 states.push(state)
1823
1824 return (
1825 <div>
1826 <button onClick={() => refetch()}>refetch</button>
1827 data: {state.data}
1828 </div>
1829 )
1830 }
1831
1832 function SecondComponent() {
1833 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