| 1830 | const states: Array<UseQueryResult<number>> = [] |
| 1831 | |
| 1832 | function FirstComponent() { |
| 1833 | const state = useQuery({ |
| 1834 | queryKey: key, |
| 1835 | queryFn: async () => { |
| 1836 | await sleep(10) |
| 1837 | return 1 |
| 1838 | }, |
| 1839 | notifyOnChangeProps: 'all', |
| 1840 | }) |
| 1841 | const refetch = state.refetch |
| 1842 | |
| 1843 | states.push(state) |
| 1844 | |
| 1845 | return ( |
| 1846 | <div> |
| 1847 | <button onClick={() => refetch()}>refetch</button> |
| 1848 | data: {state.data} |
| 1849 | </div> |
| 1850 | ) |
| 1851 | } |
| 1852 | |
| 1853 | function SecondComponent() { |
| 1854 | useQuery({ queryKey: key, queryFn: () => 2, notifyOnChangeProps: 'all' }) |