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

Function FirstComponent

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

Source from the content-addressed store, hash-verified

1790 const states: Array<UseQueryResult<number>> = []
1791
1792 function FirstComponent() {
1793 const state = useQuery({
1794 queryKey: key,
1795 queryFn: () => sleep(10).then(() => 1),
1796 notifyOnChangeProps: 'all',
1797 })
1798 const refetch = state.refetch
1799
1800 states.push(state)
1801
1802 return (
1803 <div>
1804 <button onClick={() => refetch()}>refetch</button>
1805 data: {state.data}
1806 </div>
1807 )
1808 }
1809
1810 function SecondComponent() {
1811 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