Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TheIncredibleHarsh/7dfc0aab9f57110563939b4fd20c73ed to your computer and use it in GitHub Desktop.
Save TheIncredibleHarsh/7dfc0aab9f57110563939b4fd20c73ed to your computer and use it in GitHub Desktop.
sample code
return fetch('https://newsapi.org/v2/top-headlines?country=jp&apiKey=145cae52067945059c40a596650cb455')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
dataSource: responseJson.articles,
}, function(){
});
})
.catch((error) =>{
console.error(error);
});
https://newsapi.org/v2/top-headlines?country=us&apiKey=145cae52067945059c40a596650cb455
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment