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

I am getting an error that unexpected token , expected "]" #15

Open
Darshan972 opened this issue Sep 2, 2019 · 1 comment
Open

I am getting an error that unexpected token , expected "]" #15

Darshan972 opened this issue Sep 2, 2019 · 1 comment

Comments

@Darshan972
Copy link

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)
})

@JulianG
Copy link
Owner

JulianG commented Sep 2, 2019

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).

Cheers,
Julian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants