Код: Выделить всё
const [validationResults, setValidationResults] = useState([]);
const handleValidate = async () => {
const response = await fetch('/api/validate');
const data = await response.json();
setValidationResults(data);
console.log(validationResults); // Still shows old value!
// How do I access the updated results here?
};
Подробнее здесь: https://stackoverflow.com/questions/798 ... ated-value
Мобильная версия