Last active
November 15, 2021 02:20
-
-
Save doug65536/6b14b729174e80067373c4e08d8e9342 to your computer and use it in GitHub Desktop.
setStatePromise
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
export function setStatePromise<S, C extends Component>( | |
component: C, state: Partial<S>): Promise<void> { | |
return new Promise((resolve, _) => { | |
component.setState(state, () => { | |
resolve(); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You would call it like this: