Personally, I like the simplicity of both, but I use more Axios, I would like to know your opinions about it.
I attach an example of the basic use of Axios:
const fetchData = async() => {
try{
const get_data = await axios.get("URL");
}
catch(error){
console.log(error);
}
}
// call the function
fetchData();
This has really helped me a lot and I have no complaints, but when talking about performance and being an external library, this question arises.
thanks for reading :D
Top comments (2)
I used native
fetch
for the first time now, and I like it.The Rust-style with
response.ok
instead of throwing is easier to handle/read.Also, the timeout handling, JSON en/decoding is working out of the box.
If you do not need to support node versions which do not provide native fetch - go for fetch
Tks Sebastian for your kind opinion, if I have read a little about those advantages.