Last active
February 22, 2017 12:14
-
-
Save chiefGui/2f9d8bbf102615df1d9440f5115ac873 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, PropTypes} from 'react' | |
class Modal extends Component { | |
state = {isOpen: false} | |
static propTypes = { | |
isOpen: PropTypes.bool | |
} | |
componentWillMount() { | |
this.setState({isOpen: this.props.isOpen}) | |
} | |
renderContent () { | |
return ( | |
<div id="modal"> | |
<form> | |
<input type="text" placeholder="Your e-mail" /> | |
<textarea placeholder="What are your thoughts?" /> | |
<button onClick={this.setState({isOpen: false})}>Close</button> | |
<button>Send</button> | |
</form> | |
</div> | |
) | |
} | |
render () { | |
{isOpen} = this.state | |
return isOpen ? this.renderContent() : null | |
} | |
} | |
export default Modal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment