2.0.7 • Published 1 year ago
react-use-confirm-alert v2.0.7
To install, you can use npm or yarn:
$ npm install --save react-use-confirm-alert
$ yarn add react-use-confirm-alert
Live demo
Examples
Here is a simple example of react-use-confirm-alert being used in a component:
import React from 'react'
import ReactDOM from 'react-dom/client'
import { ConfirmAlertProvider } from 'react-use-confirm-alert'
import App from './App'
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<ConfirmAlertProvider>
<App />
</ConfirmAlertProvider>
</React.StrictMode>
)
import { useConfirmAlert } from "react-use-confirm-alert"
export default function Book() {
const confirmAlert = useConfirmAlert()
async function handleDelete() {
const isConfirmed = await confirmAlert({
title: "Are you sure?",
message: "This action cannot be undone"
})
if (isConfirmed) {
//delete the book
}
}
return (
<div>
<button onClick={handleDelete}>Delete</button>
</div>
)
}
2.0.7
1 year ago
2.0.6
1 year ago
2.0.3
1 year ago
2.0.4
1 year ago
2.0.2
1 year ago
2.0.1
1 year ago
1.2.6
2 years ago
1.2.5
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.1.7
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.1
2 years ago
1.2.0
2 years ago
1.7.0
2 years ago
1.6.0
2 years ago
1.5.0
2 years ago
1.4.0
2 years ago
1.3.0
2 years ago
1.1.0
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago