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

Function FirstComponent

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

Source from the content-addressed store, hash-verified

1813 const states: Array<UseQueryResult<number>> = []
1814
1815 function FirstComponent() {
1816 const state = useQuery({
1817 queryKey: key,
1818 queryFn: () => sleep(10).then(() => 1),
1819 notifyOnChangeProps: 'all',
1820 })
1821 const refetch = state.refetch
1822
1823 states.push(state)
1824
1825 return (
1826 <div>
1827 <button onClick={() => refetch()}>refetch</button>
1828 data: {state.data}
1829 </div>
1830 )
1831 }
1832
1833 function SecondComponent() {
1834 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