📌React Hook to ask the user for a confirmation before executing a function.
Installation
npm
npm i @bro95-hooks/use-confirm
Usage
importReactfrom"react";importuseConfirmfrom"@bro95-hooks/use-confirm";functionApp(){constdeleteWorld=()=>console.log("Deleting world...");constconfirmDelete=useConfirm("Are you sure?",deleteWorld);return<buttononClick={confirmDelete}>Delete the world</button>;}
Arguments
Argument
Type
Description
Required
message
string
Message to show the user on the confirmation propmt