Minimal use
Example of use of the library with the default configuration.
You only need to set the required properties: customFunction
, setShowConfirmToast
and showConfirmToast
.
import { useState } from 'react'import { ConfirmToast } from 'react-confirm-toast'
export function Page() { const [show, setShow] = useState(false)
function myFunction() { alert('Done!') }
return ( <> <button onClick={() => { setShow(true) }} > Click to open ConfirmToast </button> <ConfirmToast customFunction={myFunction} setShowConfirmToast={setShow} showConfirmToast={show} /> </> )}