useWatch

Function: useWatch()

useWatch<T>(hook, options?): WagmiHookReturnType<T>

A custom hook that watches blockchain changes and triggers refetching logic based on specified criteria such as block number differences.

Type Parameters

T extends object

Parameters

hook

WagmiHookReturnType<T>

The original hook provided by the Wagmi library with its data and methods.

options?

UseWatchOptions

Optional settings to configure the watching behavior, including whether to watch, block difference threshold, and chainId.

Returns

WagmiHookReturnType<T>

Returns the original hook, preserving its functionality while adding watch-based refetching logic.

Defined in

packages/wagmi/src/hook/useWatch.tsx:46

Last updated