// src/hooks/useLiveRef.tsx
import { useCallback, useRef, useState } from "react";
function useLiveRef() {
  const [ready, setReady] = useState(false);
  const ref = useRef(null);
  const refCb = useCallback((node) => {
    if (node !== null) {
      ref.current = node;
      setReady(true);
    }
  }, []);
  return [ready ? ref : { current: null }, refCb];
}

export {
  useLiveRef
};
