UNPKG

@s-ui/react-organism-nested-checkboxes

Version:

This component shows a parent checkbox with children that their controls his own state.

23 lines 623 B
import { useEffect, useRef } from 'react'; var useMutationObserver = function useMutationObserver(callback, options) { if (options === void 0) { options = { attributes: true, characterData: true, childList: true, subtree: true }; } var ref = useRef(); useEffect(function () { if (ref.current) { var observer = new MutationObserver(callback.bind(null, ref.current)); observer.observe(ref.current, options); return function () { return observer.disconnect(); }; } }, [callback, options]); return [ref]; }; export default useMutationObserver;