0.0.7 • Published 6 years ago

react-confirmation v0.0.7

Weekly downloads
13
License
MIT
Repository
github
Last release
6 years ago

React confirmation dialog box

Install

npm install react-confirmation --save

Demo

Usage

React confirmation dialog example
import React, { Component } from 'react';
import Confirmation from 'react-confirmation';

class Confirmation extends Component {
  constructor(props) {
    super(props);
    this.state = {
      showConfirm: false
    };
  }
  handelConfirmation = () => {
    this.setState({ showConfirm: !this.state.showConfirm });
  }
  render() {
    const confirmOptions = {
      title: 'Confirm to submit',
      message: 'Are you sure want to do this..?',
      buttons: [
        {
          label: 'Cancel',
          onClick: () => {
            this.setState({ showConfirm: false });
          }
        },
        {
          label: 'Ok',
          onClick: () => { alert("ok") }
        }
      ]
    };
    return (
      <React.Fragment>
        {this.state.showConfirm ? <Confirmation options={confirmOptions} /> : ''}
      </React.Fragment>
    );
  }
}

PROPTYPES

PropTypeRequired
optionsObjectYes

react-confirmation

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago