Created
August 7, 2022 13:41
-
-
Save vaibhavgehani/f960f0a4ad3398130186be6b6445111f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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