You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this.setState(imgLink: data.items[0].snippet.thumbnails.default.url); //at 0 i am getting error
this.setState(width: data.items[0].snippet.thumbnails.default.url.width);
this.setState(height: data.items[0].snippet.thumbnails.default.url.height);
}
here is how i fetch the api:
this.setState({url: url});
return fetch(url)
.then((response) => response.json())
// fetchData(data);
.then((data) => {fetchData(data)
})
The text was updated successfully, but these errors were encountered:
Hello @Darshan972 I'm afraid I would need a bit more context to be able to help you.
Could you recreate your issue in a codesandbox? You could try forking my example (https://codesandbox.io/s/lpwn789x97).
Here is the code:
fetchData = (data) => {
this.setState(imgLink: data.items[0].snippet.thumbnails.default.url); //at 0 i am getting error
this.setState(width: data.items[0].snippet.thumbnails.default.url.width);
this.setState(height: data.items[0].snippet.thumbnails.default.url.height);
}
here is how i fetch the api:
this.setState({url: url});
return fetch(url)
.then((response) => response.json())
// fetchData(data);
.then((data) => {fetchData(data)
})
The text was updated successfully, but these errors were encountered: