Skip to content

Instantly share code, notes, and snippets.

@thulioph
Last active September 20, 2018 03:50
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 thulioph/9a71586e8ee3270263578ada191f7fae to your computer and use it in GitHub Desktop.
Save thulioph/9a71586e8ee3270263578ada191f7fae to your computer and use it in GitHub Desktop.
An example to demonstrate a Modal component using class.
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