Created
May 4, 2019 19:29
-
-
Save abhikulshrestha22/35c7bc198d925820f0d9d2da513ee26e to your computer and use it in GitHub Desktop.
React-Bootbox implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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