Skip to content

Instantly share code, notes, and snippets.

@dainelmawer
Last active October 11, 2018 06:57
Show Gist options
  • Save dainelmawer/983cc37115fa2aa0a6afff018c79e751 to your computer and use it in GitHub Desktop.
Save dainelmawer/983cc37115fa2aa0a6afff018c79e751 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import ModalWindow from './ModalWindow';
class Modal extends Component {
constructor() {
super();
this.state = {
isOpen: false,
}
}
handleModal() {
this.setState({
isOpen: !isOpen
});
}
render() {
const { isOpen } = this.state;
const modalCls = isOpen ? 'active' : '';
return(
<button onClick={() => handleModal()}>Open Modal</button>
<ModalWindow className={modalCls} />
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment