Last active
October 11, 2018 06:57
-
-
Save dainelmawer/983cc37115fa2aa0a6afff018c79e751 to your computer and use it in GitHub Desktop.
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, { 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