preact-missing-hooks
Version:
A lightweight, extendable collection of missing React-like hooks for Preact — plus fresh, powerful new ones designed specifically for modern Preact apps.
10 lines (9 loc) • 465 B
TypeScript
import { RefObject } from "preact";
export type UseMutationObserverOptions = MutationObserverInit;
/**
* A Preact hook to observe DOM mutations using MutationObserver.
* @param target - The element to observe.
* @param callback - Function to call on mutation.
* @param options - MutationObserver options.
*/
export declare function useMutationObserver(targetRef: RefObject<HTMLElement | null>, callback: MutationCallback, options: MutationObserverInit): void;