react-code-dataset / react-query /docs /framework /angular /reference /functions /providetanstackquery.md
|
Download react-query/docs/framework/angular/reference/functions/providetanstackquery.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.18 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/docs/framework/angular/reference/functions/providetanstackquery.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/docs/framework/angular/reference/functions/providetanstackquery.md
-
curl -L -o providetanstackquery.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/docs/framework/angular/reference/functions/providetanstackquery.md
2.18 kB
metadata
id: provideTanStackQuery
title: provideTanStackQuery
Function: provideTanStackQuery()
function provideTanStackQuery(queryClient, ...features): Provider[]
Sets up providers necessary to enable TanStack Query functionality for Angular applications.
Allows to configure a QueryClient and optional features such as developer tools.
Example - standalone
import {
provideTanStackQuery,
QueryClient,
} from '@tanstack/angular-query-experimental'
bootstrapApplication(AppComponent, {
providers: [provideTanStackQuery(new QueryClient())],
})
Example - NgModule-based
import {
provideTanStackQuery,
QueryClient,
} from '@tanstack/angular-query-experimental'
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
providers: [provideTanStackQuery(new QueryClient())],
bootstrap: [AppComponent],
})
export class AppModule {}
You can also enable optional developer tools by adding withDevtools. By
default the tools will then be loaded when your app is in development mode.
import {
provideTanStackQuery,
withDevtools
QueryClient,
} from '@tanstack/angular-query-experimental'
bootstrapApplication(AppComponent,
{
providers: [
provideTanStackQuery(new QueryClient(), withDevtools())
]
}
)
Example: using an InjectionToken
export const MY_QUERY_CLIENT = new InjectionToken('', {
factory: () => new QueryClient(),
})
// In a lazy loaded route or lazy loaded component's providers array:
providers: [provideTanStackQuery(MY_QUERY_CLIENT)]
Parameters
queryClient
A QueryClient instance, or an InjectionToken which provides a QueryClient.
QueryClient | InjectionToken<QueryClient>
features
...QueryFeatures[]
Optional features to configure additional Query functionality.
Returns
Provider[]
A set of providers to set up TanStack Query.