2.0.7 • Published 29 days ago

react-use-confirm-alert v2.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
29 days ago

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

29 days ago

2.0.6

29 days ago

2.0.3

1 month ago

2.0.4

1 month ago

2.0.2

1 month ago

2.0.1

3 months ago

1.2.6

4 months ago

1.2.5

4 months ago

1.2.4

4 months ago

1.2.3

4 months ago

1.2.2

4 months ago

1.2.1

4 months ago

1.1.7

4 months ago

1.1.5

4 months ago

1.1.4

4 months ago

1.1.3

4 months ago

1.1.1

4 months ago

1.2.0

11 months ago

1.7.0

11 months ago

1.6.0

11 months ago

1.5.0

11 months ago

1.4.0

11 months ago

1.3.0

11 months ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

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