Download react-query/integrations/solid-vite/src/App.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 526 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/integrations/solid-vite/src/App.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/integrations/solid-vite/src/App.jsx
-
curl -L -o App.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/integrations/solid-vite/src/App.jsx
526 Bytes
| import { Match, Switch } from 'solid-js' | |
| import { useQuery } from '@tanstack/solid-query' | |
| const App = () => { | |
| const query = useQuery(() => ({ | |
| queryKey: ['test'], | |
| queryFn: async () => { | |
| await new Promise((r) => setTimeout(r, 1000)) | |
| return 'Success' | |
| }, | |
| })) | |
| return ( | |
| <Switch> | |
| <Match when={query.isPending}>Loading...</Match> | |
| <Match when={query.isError}>An error has occurred!</Match> | |
| <Match when={query.isSuccess}>{query.data}</Match> | |
| </Switch> | |
| ) | |
| } | |
| export default App | |