React Notifier
React component for notifications on the fron end.
Installation
$ npm i --save bc-react-notifier
How to use it
- Add the Notifier tag anywhere in your web app
import Notifier from 'bc-react-notifier';ReactDOM;
- Call the Notify function from anywhere in you code
; //Pass the error string or array, auto closes on 2 secNotify;//or successs stringNotify;//or info stirngNotify; //you can also pass a confirmation callback to any of the notificationsNotify;
Customize the notification with a custom component
- Create the component
const ModalComponent = onConfirm <div> <h1>Are you sure?</h1> <button =>Yes</button> <button =>No</button> </div>;
- Call the Notify function from anywhere else (passing the component)
/** * @param1: Wrapper css class * @param2: Component to render it * @param3: callback when answered * @param4: timeout in millisecons (null for no timout) **/ let noti = Notify;