Function
useInert
(
ref: RefObject<T>,
isInert: boolean,
)
Source from the content-addressed store, hash-verified
| 13 | * does not carry the attribute. |
| 14 | */ |
| 15 | export const useInert = <T extends HTMLElement>( |
| 16 | ref: RefObject<T>, |
| 17 | isInert: boolean, |
| 18 | ): void => { |
| 19 | useEffect(() => { |
| 20 | const node = ref.current; |
| 21 | if (!node) { |
| 22 | return undefined; |
| 23 | } |
| 24 | |
| 25 | node.inert = isInert; |
| 26 | return () => { |
| 27 | node.inert = false; |
| 28 | }; |
| 29 | }, [ref, isInert]); |
| 30 | }; |
| 31 | |
| 32 | export const useInertRef = <T extends HTMLElement>( |
| 33 | isInert: boolean, |
Tested by
no test coverage detected