Download react-query/examples/react/react-native/App.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 992 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/react/react-native/App.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/react/react-native/App.tsx
-
curl -L -o App.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/react/react-native/App.tsx
992 Bytes
| import * as React from 'react' | |
| import { AppStateStatus, Platform } from 'react-native' | |
| import { NavigationContainer } from '@react-navigation/native' | |
| import { | |
| QueryClient, | |
| QueryClientProvider, | |
| focusManager, | |
| } from '@tanstack/react-query' | |
| import { useAppState } from './src/hooks/useAppState' | |
| import { MoviesStack } from './src/navigation/MoviesStack' | |
| import { useOnlineManager } from './src/hooks/useOnlineManager' | |
| function onAppStateChange(status: AppStateStatus) { | |
| // React Query already supports in web browser refetch on window focus by default | |
| if (Platform.OS !== 'web') { | |
| focusManager.setFocused(status === 'active') | |
| } | |
| } | |
| const queryClient = new QueryClient({ | |
| defaultOptions: { queries: { retry: 2 } }, | |
| }) | |
| export default function App() { | |
| useOnlineManager() | |
| useAppState(onAppStateChange) | |
| return ( | |
| <QueryClientProvider client={queryClient}> | |
| <NavigationContainer> | |
| <MoviesStack /> | |
| </NavigationContainer> | |
| </QueryClientProvider> | |
| ) | |
| } | |