(context?: ContextValue<T> | null, ref?: RefObject<T | null>)
| 20 | |
| 21 | // Syncs ref from context with ref passed to hook |
| 22 | export function useSyncRef<T>(context?: ContextValue<T> | null, ref?: RefObject<T | null>): void { |
| 23 | useLayoutEffect(() => { |
| 24 | if (context && context.ref && ref) { |
| 25 | context.ref.current = ref.current; |
| 26 | return () => { |
| 27 | if (context.ref) { |
| 28 | // oxlint-disable-next-line react-hooks/exhaustive-deps |
| 29 | context.ref.current = null; |
| 30 | } |
| 31 | }; |
| 32 | } |
| 33 | }); |
| 34 | } |
no outgoing calls
no test coverage detected