Last active
November 10, 2019 08:44
-
-
Save fsubal/f5f4bed1849b36d614f7eac82ab85568 to your computer and use it in GitHub Desktop.
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 openDialog = async (target: HTMLElement, label: string) => { | |
const answer = await new Promise<boolean>(resolve => | |
ReactDOM.render( | |
<Dialog label={label} onResolve={resolve}> | |
{body} | |
</Dialog>, | |
target, | |
), | |
) | |
ReactDOM.unmountComponentAtNode(target) | |
return answer | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment