UNPKG

812 BTypeScriptView Raw
1import type { ReactiveVar } from "../../core/index.js";
2/**
3 * Reads the value of a [reactive variable](https://www.apollographql.com/docs/react/local-state/reactive-variables/) and re-renders the containing component whenever that variable's value changes. This enables a reactive variable to trigger changes _without_ relying on the `useQuery` hook.
4 *
5 * @example
6 * ```jsx
7 * import { makeVar, useReactiveVar } from "@apollo/client";
8 * export const cartItemsVar = makeVar([]);
9 *
10 * export function Cart() {
11 * const cartItems = useReactiveVar(cartItemsVar);
12 * // ...
13 * }
14 * ```
15 * @since 3.2.0
16 * @param rv - A reactive variable.
17 * @returns The current value of the reactive variable.
18 */
19export declare function useReactiveVar<T>(rv: ReactiveVar<T>): T;
20//# sourceMappingURL=useReactiveVar.d.ts.map
\No newline at end of file