Skip to content

Instantly share code, notes, and snippets.

@vaibhavgehani
Created August 7, 2022 13:41
Show Gist options
  • Save vaibhavgehani/f960f0a4ad3398130186be6b6445111f to your computer and use it in GitHub Desktop.
Save vaibhavgehani/f960f0a4ad3398130186be6b6445111f to your computer and use it in GitHub Desktop.
const goForAxios = () => {
setFromFetch(false);
setLoading(true);
axios.get("https://jsonplaceholder.typicode.com/users")
.then(response => {
console.log('getting data from axios', response.data);
setTimeout(() => {
setLoading(false);
setAxiosData(response.data);
}, 2000)
})
.catch(error => {
console.log(error);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment