Created
July 17, 2022 04:47
-
-
Save gnowland/996ceff9968cc952e877dd6b3e7fb6aa 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
useEffect(() => { | |
isLoading = true; | |
getData(someParam).then(data => { | |
if (isLoading) { | |
setState(data)) | |
} | |
}) | |
return() => { isLoading = false } | |
}, [someParam]); // fetch only happens if param (like url) changes. Don't use objects. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read More:
Future Improvements: