Download react-query/packages/angular-query-experimental/src/inject-query-client.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 785 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/angular-query-experimental/src/inject-query-client.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/angular-query-experimental/src/inject-query-client.ts
-
curl -L -o inject-query-client.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/angular-query-experimental/src/inject-query-client.ts
785 Bytes
| import { Injector, inject } from '@angular/core' | |
| import { QueryClient } from '@tanstack/query-core' | |
| import type { InjectOptions } from '@angular/core' | |
| /** | |
| * Injects a `QueryClient` instance and allows passing a custom injector. | |
| * @param injectOptions - Type of the options argument to inject and optionally a custom injector. | |
| * @returns The `QueryClient` instance. | |
| * @public | |
| * @deprecated Use `inject(QueryClient)` instead. | |
| * If you need to get a `QueryClient` from a custom injector, use `injector.get(QueryClient)`. | |
| * | |
| * | |
| * **Example** | |
| * ```ts | |
| * const queryClient = injectQueryClient(); | |
| * ``` | |
| */ | |
| export function injectQueryClient( | |
| injectOptions: InjectOptions & { injector?: Injector } = {}, | |
| ) { | |
| return (injectOptions.injector ?? inject(Injector)).get(QueryClient) | |
| } | |