import { useEntityKey, useGetEntityByKey } from "@contember/binding";
import { useState, useRef, useEffect } from "react";
const useGetParentEntityRef = () => {
  const key = useEntityKey();
  const getEntity = useGetEntityByKey();
  const [initialGetter] = useState(() => () => getEntity(key));
  const ref = useRef(initialGetter);
  useEffect(() => {
    ref.current = () => getEntity(key);
  }, [getEntity, key]);
  return ref;
};
export { useGetParentEntityRef };
//# sourceMappingURL=useGetParentEntityRef.js.map
