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

Function FirstComponent

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

Source from the content-addressed store, hash-verified

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