import {useRef} from 'react'; const useArgByRef = (arg: T): {readonly current: T} => { const ref = useRef(arg); ref.current = arg; return ref; }; export default useArgByRef;