Skip to content

Instantly share code, notes, and snippets.

@iremlopsum
Created March 25, 2018 19:16
Show Gist options
  • Save iremlopsum/1a26127bc8eb3c5cb49c0d63988cec77 to your computer and use it in GitHub Desktop.
Save iremlopsum/1a26127bc8eb3c5cb49c0d63988cec77 to your computer and use it in GitHub Desktop.
import React, { PureComponent } from 'react';
class App extends PureComponent {
componentWillMount() {
const url = 'api.openweathermap.org/data/2.5/weather?q=München,DE&appid=382aa7ad3501c6d4a564022372982343';
fetch(url).then((res) => {
if (res.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' + res.status);
return;
}
console.log(res)
}).catch((err) => {
console.log('Fetch Error :-S', err);
})
}
render() {
return (
<div className="app" />
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment