1.0.5 • Published 1 year ago

@web-react-hooks/use-confirm v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

yarn yarn add @web-react-hooks/use-confirm

npm npm i @web-react-hooks/use-confirm

Usage

import React from "react";
import useConfirm from "@web-react-hooks/use-confirm";

function App() {
  const deleteWorld = () => console.log("Deleting world...");
  const confirmDelete = useConfirm("Are you sure?", deleteWorld);
  return <button onClick={confirmDelete}>Delete the world</button>;
}

Arguments

ArgumentTypeDescriptionRequired
messagestringMessage to show the user on the confirmation propmtyes
onConfirmfunctionFunction to be executed when the user confirmsyes
onCancelfunctionFunction to be executed when the user cancelsno

Return

Return valueTypeDescription Default value
functionfunction Function wrapped around the confirmation logicnull
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago