react-async-popup
v0.0.6
Published
An accessible promise based popup library for react, to reduce extra state management needed for popups.
Downloads
175
Maintainers
Readme
react-async-popup
A promise based popup (confirm and modal) library for react, to reduce extra state management needed for popups. checkout the docs here - https://aadil.dev/react-async-popup
Install
npm install --save react-async-popup
or
yarn add react-async-popup
Usage
import React from 'react'
import { Confirm } from 'react-async-popup'
function App() {
async function onDelete() {
const { show } = await Confirm.new();
const result = await show({
title: ' Are you sure you want to delete the file ?'
});
if (result) {
console.log(" Yes, Delete the file ")
}else{
console.log(" Don't delete ")
}
}
return <button onClick={onDelete}> Delete File </button>
}
Find more examples here - https://aadil.dev/react-async-popup/examples
License
MIT © aadilhasan