Reputation: 19
Axios starts making the GET request and never stops anymore when I add the following code to the component data. No changing on the state or no calling the setState method.
componentDidMount() {
axios('https://api.npms.io/v2/search?q=react')
.then(response => {
alert(response.data);
});
}
Upvotes: 1
Views: 147
Reputation: 12777
I think you should use axios.get(), not axios():
axios.get('https://api.npms.io/v2/search?q=react')
.then(response => {
alert(response.data);
});
Upvotes: 1