@wojtekmaj/react-hooks
Version:
A collection of React Hooks.
12 lines (11 loc) • 597 B
TypeScript
/**
* Observes a given element using MutationObserver.
*
* @param {Node} [element] Element to attach MutationObserver to
* @param {MutationObserverInit} [options] MutationObserver options. WARNING! If you define the
* object in component body, make sure to memoize it.
* @param {MutationCallback} observerCallback MutationObserver callback. WARNING! If you define the
* function in component body, make sure to memoize it.
* @returns {void}
*/
export default function useMutationObserver(element: Node | null, options: MutationObserverInit, observerCallback: MutationCallback): void;