I am using react in which inside a component I have a button on which click I am running an API https://dog.ceo/api/breeds/list/all
this one is from Dog.ceo
to fetch all breeds of dogs, but every time I hit this url it says network error, I am totally fed up now don't know what is missing in my code
import React, { Component } from 'react'
import axios from 'axios'
class Welcome extends Component {
clickBtn(){
axios.get(`https://dog.ceo/api/breeds/list/all`)
.then((res)=>{
debugger
console.log(res)
})
.catch(err=>console.log(err))
}
render() {
return (
<div>
<button
onClick={this.clickBtn}
className="btn btn-primary">Click</button>
</div>
)
}
}
export default Welcome
This same code I am writing in code sandbox then it is returning correct responce then why in my code Do I need to bring Something In?