Size
0.34 kb
useMutationObserver
The MutationObserver API, reactified and simplified
Installation
Usage
Observe an element’s child list mutation:
Manual observation control:
API Reference
UseMutationObserverOptions
The options for the useMutationObserver hook. See MDN docs for more details.
| Prop | Type | Default |
|---|---|---|
autoObserve? | boolean | true |
subtree? | boolean | - |
childList? | boolean | - |
characterDataOldValue? | boolean | - |
characterData? | boolean | - |
attributes? | boolean | - |
attributeOldValue? | boolean | - |
attributeFilter? | string[] | - |
UseMutationObserverReturn
The return value of the useMutationObserver hook.
| Prop | Type | Default |
|---|---|---|
target | Element | null | - |
ref | Function | - |
unobserve | () => void | - |
observe | () => void | - |