react-async-popup
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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

Package Sidebar

Install

npm i react-async-popup

Weekly Downloads

52

Version

0.0.6

License

MIT

Unpacked Size

19.5 kB

Total Files

9

Last publish

Collaborators

  • aadil-hasan