Open History to see the last commit
1import {
2 QueryClient,
3 QueryClientProvider,
4 useQuery,
5} from '@tanstack/octane-query';
6β
7const client = new QueryClient();
8β
9export function Cached() @{
10 const q = useQuery({
11 queryKey: ['c'],
12 queryFn: () => Promise.resolve('fetched'),
13 initialData: 'seed',
14 staleTime: Infinity,
15 });
16 <div id="d">{'data=' + q.data + ' status=' + q.status + ' pending=' + q.isPending + ' fetching=' +
17 q.isFetching +
18 ' success=' +
19 q.isSuccess as string}</div>
20}
21β
22export function CachedApp() @{
23 <QueryClientProvider client={client}>
24 <Cached />
25 </QueryClientProvider>
26}