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

Function FirstComponent

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

Source from the content-addressed store, hash-verified

1795 const states: Array<UseQueryResult<number>> = []
1796
1797 function FirstComponent() {
1798 const state = useQuery({
1799 queryKey: key,
1800 queryFn: () => sleep(10).then(() => 1),
1801 notifyOnChangeProps: 'all',
1802 })
1803 const refetch = state.refetch
1804
1805 states.push(state)
1806
1807 return (
1808 <div>
1809 <button onClick={() => refetch()}>refetch</button>
1810 data: {state.data}
1811 </div>
1812 )
1813 }
1814
1815 function SecondComponent() {
1816 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