import { useRef } from "react"; export function useFreshRef(value: TValue): React.RefObject { const ref = useRef(value); ref.current = value; return ref; }