schiehll / react-alert

alerts for React
MIT License
607 stars 98 forks source link

Did you have example for confirm dialog using this package? #7

Closed aligos closed 7 years ago

aligos commented 8 years ago

i want to make confirm dialog ok and cancle with this alert

dherran commented 8 years ago

As per my experience with the module it seems to only support alerts.

karensg commented 6 years ago

Would be awesome though to support confirm as well as it is the best library for react around. I managed to do it like this:

    let alerts = [];
    alerts.push(this.props.alert.info(
      <div>Are you sure?<br/>
        <button className="btn confirm" onClick={() => {
          this.props.alert.remove(alerts[0]);
        }}>No
        </button>
        <button className="btn confirm danger" onClick={() => {
          this.deleteStuff();
          this.props.alert.remove(alerts[0]);
        }}>Yes
        </button>
      </div>
    ));