According to the axios GitHub code (axios/lib/core/settle.js):
reject(createError(
'Request failed with status code ' + response.status,
response.config,
null,
response.request,
response
));
The response was rejected because of an invalid status code (most likely an HTML 401). Check if your api key is still valid, or test your URL in postman.
EDIT: Below is a working code snippet based on the new URL
class Hello extends React.Component {
constructor() {
super();
this.state={
report: null,
};
}
componentDidMount() {
axios.get(`https://api.openweathermap.org/data/2.5/weather?q=London,uk&APPID=3a31a881817a041a63eac1c1bbbba705`)
.then((response)=>{
this.setState({report:response.data});
console.log(response.data);
}).catch((error)=>console.log(error))
}
render() {
return <div>Report: {JSON.stringify(this.state.report)}</div>;
}
}
ReactDOM.render(
<Hello />,
document.getElementById('container')
);
<script src="https://unpkg.com/axios@0.16.1/dist/axios.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<div id="container">
</div>