/** * Sample React Native App * https://github.com/facebook/react-native * * @format */ import React from "react"; import { SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, useColorScheme, View, Button, } from "react-native"; import { useNetInfoInstance } from "@react-native-community/netinfo"; import { useQuery, useMutation, useQueryClient, QueryClient, QueryClientProvider, } from "@tanstack/react-query"; import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"; import { createAsyncStoragePersister } from "@tanstack/query-async-storage-persister"; import AsyncStorage from "@react-native-async-storage/async-storage"; const queryClient = new QueryClient({ defaultOptions: { queries: { gcTime: 1000 * 60 * 60 * 24, // 24 hours }, }, }); const asyncStoragePersister = createAsyncStoragePersister({ storage: AsyncStorage, }); // Define the "addTodo" mutation queryClient.setMutationDefaults(["addTodo"], { mutationFn: ({ page }) => { return makeCall(page); }, retry: 3, }); function makeCall(page) { return fetch(`http://10.0.2.2:8080/${page}`) .then(response => { return response; }) .catch(error => { console.log(error); console.log(12); }); } function App() { return ( ); } const ReqButton = () => { const mutation = useMutation({ mutationKey: ["addTodo"] }); return (