1.0.8 • Published 5 years ago

rc-confirm-alert v1.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

rc-confirm-alert

Yet another confirm alert for React

Installation

npm install rc-confirm-alert

Usage

Use it as a function

import { reactAlert } from 'rc-confirm-alert';

reactAlert({
  width: '500px',
  title: 'Are you sure?',
  onCancel: () => doSomethingOnCancel(),
  onConfirm: () => doSomethingOnConfirm(),
});

Also supports hooks

import { useReactAlert } from 'rc-confirm-alert';

function UI() {
  const dialog = useReactAlert();

  return (
    <React.Fragment>
      <button onClick={() => dialog.open()}>Open Modal</button>
    </React.Fragment>
  );
}

Custom UI

import { reactAlert } from 'rc-confirm-alert';

reactAlert({
  render: (props) => <CustomUI {...props} />,
  onCancel: () => { ... },
  onConfirm: () => { ... },
});
function CustomUI({ cancel, confirm }) { ... }
1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago