React Async Modal
A simple tool for creating modals with Promise style usage based on react-responsive-modal
Install
- yarn:
yarn add react-async-modal
- npm:
npm i react-async-modal --save
Usage example
// Importing;; // Setup default modal settings (optional)asyncModal.setDefaultModalProps; // Defining modal component // Calling modal with async/await style;console.logresult; // Or with Promise styleasyncModalMyConfirm, , .then;
There are two methods will be injected to props
of MyConfirm
component:
resolve
method to send payload and close modalclose
method to sendnull
as payload and close modal
Modal customization
Use modalProps
argument or asyncModal.setDefaultModalProps()
method to pass props to react-responsive-modal
Available props: https://react-responsive-modal.leopradel.com/#props