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

Function FirstComponent

packages/preact-query/src/__tests__/useQuery.test.tsx:1783–1799  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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