useMutationObserver
Handle the MutationObserver (opens in a new tab) to track changes being made to the DOM tree.
Type Definitions
type MutationObserverOptions<T extends HTMLElement> = MutationObserverInit & {
ref?: React.RefObject<T> | null;
};
const useMutationObserver: <T extends HTMLElement = HTMLDivElement>(args: MutationObserverOptions<T> & {
handler: MutationCallback;
}) => {
ref: React.RefObject<T>;
observerRef: React.MutableRefObject<MutationObserver | undefined>;
};