Created
March 16, 2024 15:03
-
-
Save JacobThaDev/d25698073e7f488d2289847a335977ad to your computer and use it in GitHub Desktop.
How to update the state from previous case study
This file contains 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 update = () => { | |
// can not be within 5 seconds of each other. | |
if (account.getLastUpdate() - new Date().getTime() < 5000) { | |
return; | |
} | |
// update account then reset the state so it updates! | |
account.update().then((returnedScope: any) => { | |
let currentTime = new Date().getTime(); | |
setAccount(returnedScope); // update account data! | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment