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

Function FirstComponent

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

Source from the content-addressed store, hash-verified

1777 const states: Array<UseQueryResult<number>> = []
1778
1779 function FirstComponent() {
1780 const state = useQuery({
1781 queryKey: key,
1782 queryFn: () => sleep(10).then(() => 1),
1783 notifyOnChangeProps: 'all',
1784 })
1785 const refetch = state.refetch
1786
1787 states.push(state)
1788
1789 return (
1790 <div>
1791 <button onClick={() => refetch()}>refetch</button>
1792 data: {state.data}
1793 </div>
1794 )
1795 }
1796
1797 function SecondComponent() {
1798 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