Skip to content

Instantly share code, notes, and snippets.

@fsubal
Last active November 10, 2019 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fsubal/f5f4bed1849b36d614f7eac82ab85568 to your computer and use it in GitHub Desktop.
Save fsubal/f5f4bed1849b36d614f7eac82ab85568 to your computer and use it in GitHub Desktop.
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