Skip to content

Instantly share code, notes, and snippets.

@abhikulshrestha22
Created May 4, 2019 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhikulshrestha22/35c7bc198d925820f0d9d2da513ee26e to your computer and use it in GitHub Desktop.
Save abhikulshrestha22/35c7bc198d925820f0d9d2da513ee26e to your computer and use it in GitHub Desktop.
React-Bootbox implementation
import React from 'react';
import './App.css';
import BootBox from 'react-bootbox';
class App extends React.Component {
constructor(props){
super(props);
this.state = {
show: false
}
}
showAlert = () => {
alert('Yes is clicked');
}
handleClose = () => {
this.setState({show:false})
}
render(){
return (
<div className="App">
<button onClick={()=>{this.setState({show:true})}}>Click me to open BootBox</button>
<BootBox
message="Do you want to Continue?"
show={this.state.show}
onYesClick = {this.showAlert}
onNoClick = {this.handleClose}
onClose = {this.handleClose}/>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment