Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 6, 2021 11:26
Show Gist options
  • Save percybolmer/28873f3fc111f51a5cc1b679ac38017a to your computer and use it in GitHub Desktop.
Save percybolmer/28873f3fc111f51a5cc1b679ac38017a to your computer and use it in GitHub Desktop.
useEffect(() => {
// Only get profile if we are completly loaded
if (loaded && (accounts !== 0)) {
// get user info
console.log(accounts);
getUserProfile()
} else {
// dirty trick to trigger reload if something went wrong
setTimeout(setLoaded(true), 500);
}
// This here subscribes to changes on the loaded and accounts state
}, [loaded, accounts]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment