... const [details, setDetails] = useState({}) const stateRef = useRef(details) stateRef.current = details const callbackFn = () => { const currentDetails = stateRef.current }