Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token ,expected "[" #26347

Closed
Darshan972 opened this issue Sep 5, 2019 · 2 comments
Closed

Unexpected token ,expected "[" #26347

Darshan972 opened this issue Sep 5, 2019 · 2 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@Darshan972
Copy link

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 is the func call and how i 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 = ; // hided by me here
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 = ; // hided
return fetch(url)
.then((response) => response.json())
updateSubscribers = (response);
},0)

.catch((error) => {
console.log(error);
});
}

@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

👉 Click here if you want to report a reproducible bug or regression in React Native.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: No Template labels Sep 5, 2019
@shubhamaniket
Copy link

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 is the func call and how i 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 = ; // hided by me here
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 = ; // hided
return fetch(url)
.then((response) => response.json())
updateSubscribers = (response);
},0)

.catch((error) => {
console.log(error);
});
}

No need to write this.setState every time for different line you can just call it in a single line

this.setState({
imgLink: ----,
width: ----,
height: ----,
)}

@facebook facebook locked as resolved and limited conversation to collaborators Oct 4, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants