React Função de retorno de chamada nativo usa o valor padrão do estado
...
const [details, setDetails] = useState({})
const stateRef = useRef(details)
stateRef.current = details
const callbackFn = () => {
const currentDetails = stateRef.current
}
florinrelea