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

Function FirstComponent

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

Source from the content-addressed store, hash-verified

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