Answer the question
In order to leave comments, you need to log in
How to take an array from a promise?
Hello. I can't figure out how promise works. I'm fetching an array from the server, but it's not possible to parse.
I change the state in react.
this.setState({
info:api.getInfo().then(({data}) => data)
})
Answer the question
In order to leave comments, you need to log in
api.getInfo().then(({data}) => {
this.setState({
info: data
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question