Download react-query/packages/svelte-query/tests/useIsMutating/BaseExample.svelte from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 563 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/svelte-query/tests/useIsMutating/BaseExample.svelte
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/svelte-query/tests/useIsMutating/BaseExample.svelte
-
curl -L -o BaseExample.svelte https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/svelte-query/tests/useIsMutating/BaseExample.svelte
563 Bytes
| <script lang="ts"> | |
| import { QueryClient } from '@tanstack/query-core' | |
| import { createMutation, useIsMutating } from '../../src/index.js' | |
| import { sleep } from '@tanstack/query-test-utils' | |
| const queryClient = new QueryClient() | |
| const isMutating = useIsMutating(undefined, queryClient) | |
| const mutation = createMutation( | |
| { | |
| mutationKey: ['mutation-1'], | |
| mutationFn: () => sleep(10).then(() => 'data'), | |
| }, | |
| queryClient, | |
| ) | |
| </script> | |
| <button on:click={() => $mutation.mutate()}>Trigger</button> | |
| <div>isMutating: {$isMutating}</div> | |