gistlib
index.tsxfunction fetchData() { fetch('API URL') .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.log(error)) } fetchData(); 188 chars9 lines
function fetchData() { fetch('API URL') .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.log(error)) } fetchData();
index.tsximport axios from 'axios'; function fetchData() { axios.get('API URL') .then(response => console.log(response.data)) .catch(error => console.log(error)) } fetchData(); 190 chars10 lines
import axios from 'axios'; function fetchData() { axios.get('API URL') .then(response => console.log(response.data)) .catch(error => console.log(error)) } fetchData();
gistlibby LogSnag