sweetalert2-react
Declarative SweetAlert in React
Introduction
This is a React SweetAlert wrapper for https://github.com/limonte/sweetalert2
Install
$ npm install sweetalert2-react
Usage
;; // ... { return <div> <button onClick= this>Alert</button> <SweetAlert show=thisstateshow title="Demo" text="SweetAlert in React" onConfirm= this /> </div> ;}
Since 0.6, you can wrap your own sweetalert2 (swal) instance:
;;; const SweetAlert = ; // ... { return <div> <button onClick= this>Alert</button> <SweetAlert show=thisstateshow title="Demo" text="SweetAlert in React" onConfirm= this /> </div> ;}
Tests
Tests were not updated to support sweetalert2. PRs are welcome.
License
MIT © C.T. Lin