Answer the question
In order to leave comments, you need to log in
Why is state only updated after second click of react hook?
const deleteUser = () => {
axios.get(`http://localhost:3001/users/${user.id}`)
.then(({ data }) => {
console.log(data)
setDataa(data)
axios.get(`http://localhost:3001/lists`)
.then(({ data }) => {
data.map(l => {
if(dataa && l.userId === dataa.id){
console.log(l)
}
})
})
})
.catch(e => {
alert('Ошибка');
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question