use-mutation-observer
Observe the changes of a reference using MutationObserver
Module
import { 
    useMutationObserver, 
    useMutationObserverState 
} from "@atomico/hooks/use-mutation-observer";useMutationObserver syntax
Observe mutations using a callback
useMutationObserver(    
    ref: Ref<Element>,    
    observe: MutationCallback,    
    config?: MutationObserverInit
);useMutationObserver syntax
Reflects mutations in a state
const mutations:MutationRecord[] = useMutationObserverState(    
    ref: Ref<Element>,    
    config?: MutationObserverInit
);Example
Last updated
Was this helpful?
