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
// fetch the value entered in the input field
alert(channelId);
this.setState({channelId:channelId})
//fetch the value(channelId) that is enter in the input field
// make a request
var url = 'https://www.googleapis.com/youtube/v3/channels?key='+API_key+'&id=' + channelId + '&part=snippet,contentDetails,statistics';
alert(url);
this.setState({url: url});
return fetch(url)
.then((response) => response.json())
// fetchData(data);
.then((data) => {
fetchData(data)
})
//now fetching the response from the yt api again and again
.setInterval(() =>
{
var url = 'https://www.googleapis.com/youtube/v3/channels?key='+API_key+'&id=' + channelId + '&part=snippet,contentDetails,statistics';
return fetch(url)
.then((response) => response.json())
updateSubscribers(response);
},0)
.catch((error) => {
console.log(error);
});
}
The text was updated successfully, but these errors were encountered:
I am getting an error after writing this code:
fetchData = (data) => {
this.setState(imgLink: data.items[0].snippet.thumbnails.default.url);//at 0 iam 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 how i call this func and fetch api:
onPressedButton = channelId =>
{
// fetch the value entered in the input field
alert(channelId);
this.setState({channelId:channelId})
//fetch the value(channelId) that is enter in the input field
// make a request
var url = 'https://www.googleapis.com/youtube/v3/channels?key='+API_key+'&id=' + channelId + '&part=snippet,contentDetails,statistics';
alert(url);
this.setState({url: url});
return fetch(url)
.then((response) => response.json())
// fetchData(data);
.then((data) => {
fetchData(data)
})
//now fetching the response from the yt api again and again
.setInterval(() =>
{
var url = 'https://www.googleapis.com/youtube/v3/channels?key='+API_key+'&id=' + channelId + '&part=snippet,contentDetails,statistics';
return fetch(url)
.then((response) => response.json())
updateSubscribers(response);
},0)
.catch((error) => {
console.log(error);
});
}
The text was updated successfully, but these errors were encountered: