diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-15 17:15:20 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-15 17:26:17 +0100 |
| commit | 26a1e3a7a08e4b0fdb4dfcc3ed6a6cc21bcef104 (patch) | |
| tree | 68d0ddf7cdc1e83f3f56607f6c4fee1f0bbd9820 /src/utils/hooks/use-mutation-observer.tsx | |
| parent | 36baf3e5725aeae00d81d3a082b3c04074e09f8e (diff) | |
refactor(hooks): remove unused hooks
* useMutationObserver removed
* useStateChange removed
Diffstat (limited to 'src/utils/hooks/use-mutation-observer.tsx')
| -rw-r--r-- | src/utils/hooks/use-mutation-observer.tsx | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/utils/hooks/use-mutation-observer.tsx b/src/utils/hooks/use-mutation-observer.tsx deleted file mode 100644 index c56f7aa..0000000 --- a/src/utils/hooks/use-mutation-observer.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { useEffect } from 'react'; - -type UseMutationObserverProps = { - callback: () => void; - options: MutationObserverInit; - nodeOrSelector: string | HTMLElement; -}; - -export const useMutationObserver = ({ - callback, - options, - nodeOrSelector, -}: UseMutationObserverProps) => { - useEffect(() => { - const targetNode = - typeof nodeOrSelector === 'string' - ? document.querySelector(nodeOrSelector)! - : nodeOrSelector; - - const observer = new MutationObserver(callback); - - observer.observe(targetNode, options); - - return () => { - observer.disconnect(); - }; - }, [nodeOrSelector, options, callback]); -}; |
