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