useMutationObserver

Watch for changes being made to the DOM tree

Demo

Usage

const const el: Kaioken.MutableRefObject<HTMLElement | null>el = useRef<HTMLElement | null>(initialValue: HTMLElement | null): Kaioken.MutableRefObject<HTMLElement | null> (+2 overloads)useRef<HTMLElement | null>(null)
const 
const controls: {
    isSupported: boolean;
    start: () => void;
    stop: () => void;
}
controls
=
function useMutationObserver(ref: Kaioken.MutableRefObject<Element | null>, callback: MutationCallback, options?: MutationObserverInit | undefined): {
    isSupported: boolean;
    start: () => void;
    stop: () => void;
}
useMutationObserver
(const el: Kaioken.MutableRefObject<HTMLElement | null>el, (mutation: MutationRecord[]mutation) => {
// code goes here })