Skip to content

Instantly share code, notes, and snippets.

@daveteu
Last active December 8, 2020 23:18
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 daveteu/f3089aa6268b1ff27f622e26148bfa31 to your computer and use it in GitHub Desktop.
Save daveteu/f3089aa6268b1ff27f622e26148bfa31 to your computer and use it in GitHub Desktop.
const DeleteWithUseConfirm = () => {
const [ getConfirmation, Confirmation ] = useConfirm()
const onDelete = async () => {
const status = await getConfirmation('Shall we have dinner together tonight?');
if (status) { //status = true
...We can now do the job of deleting
} else { //false
...No... don't delete.
}
}
return ( <>
<button onClick={onDelete} >Delete Me</button>
<Confirmation />
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment