Last active
December 8, 2020 23:18
-
-
Save daveteu/f3089aa6268b1ff27f622e26148bfa31 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 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