Last active
September 20, 2018 03:50
-
-
Save thulioph/9a71586e8ee3270263578ada191f7fae to your computer and use it in GitHub Desktop.
An example to demonstrate a Modal component using class.
This file contains hidden or 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 { ModalComponent } from "./Modal"; | |
class ModalContainer extends React.Component { | |
state = { | |
showModal: false | |
}; | |
onHandleModal = () => { | |
const { showModal } = this.state; | |
this.setState({ showModal: !showModal }); | |
}; | |
onBtnSuccess = () => { | |
console.warn("Success!"); | |
}; | |
onBtnCancel = () => { | |
console.warn("Cancel!"); | |
}; | |
render() { | |
return ( | |
<ModalComponent | |
{...this.props} | |
{...this.state} | |
onHandleModal={this.onHandleModal} | |
onBtnSuccess={this.onBtnSuccess} | |
onBtnCancel={this.onBtnCancel} | |
/> | |
); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment