Created
August 7, 2022 13:40
-
-
Save vaibhavgehani/82d14915713f26252bdb3b39c0e1d407 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 goForFetch = () => { | |
setFromFetch(true); | |
setLoading(true); | |
fetch("https://jsonplaceholder.typicode.com/users") | |
.then(response => response.json()) | |
.then((responseJson) => { | |
console.log('getting data from fetch', responseJson) | |
setTimeout(() => { | |
setLoading(false); | |
setDataSource(responseJson) | |
}, 2000) | |
}) | |
.catch(error => console.log(error)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment