UNPKG

amplifyquery

Version:
60 lines (59 loc) 1.63 kB
import * as React from "react"; import { QueryClient } from "@tanstack/react-query"; interface AmplifyQueryProviderProps { children: React.ReactNode; } /** * TanStack Query Provider for AmplifyQuery * * This component provides the QueryClient to the entire application. * Use this at the root of your application to enable React Query. * * @example * ```tsx * import { AmplifyQueryProvider } from 'amplifyquery/provider'; * * function App() { * return ( * <AmplifyQueryProvider> * <YourApp /> * </AmplifyQueryProvider> * ); * } * ``` */ export declare function AmplifyQueryProvider({ children, }: AmplifyQueryProviderProps): React.ReactElement; /** * Creates a custom QueryClient provider with configuration options * * @param customQueryClient Optional custom QueryClient instance * @returns A provider component with the custom client * * @example * ```tsx * import { createCustomQueryProvider } from 'amplifyquery/provider'; * import { QueryClient } from '@tanstack/react-query'; * * // Create a custom client with specific options * const customClient = new QueryClient({ * defaultOptions: { * queries: { * staleTime: 1000 * 60 * 5, * }, * }, * }); * * // Create a provider with this client * const CustomProvider = createCustomQueryProvider(customClient); * * function App() { * return ( * <CustomProvider> * <YourApp /> * </CustomProvider> * ); * } * ``` */ export declare function createCustomQueryProvider(customQueryClient?: QueryClient): ({ children }: AmplifyQueryProviderProps) => React.ReactElement; export {};