Fetching data - Fetch x Axios

PHOTO EMBED

Fri Mar 18 2022 13:46:31 GMT+0000 (Coordinated Universal Time)

Saved by @jen_magpantay #javascript

// With Fetch
fetch(url)
 .then((response) => response.json())
 .then((data) => console.log(data))
 .catch((error) => console.log(error));

// With Axios
axios.get(url)
 .then((response) => console.log(response))
 .catch((error) => console.log(error));
content_copyCOPY

https://blog.logrocket.com/understanding-axios-post-requests/