Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyComponent extends Component {
- constructor (props) {
- super(props)
- this.state = {
- showModal: false
- }
- this.showModal = this.showModal.bind(this)
- this.hideModal = this.hideModal.bind(this)
- }
- showModal () {
- this.setState({ showModal: true })
- }
- hideModal () {
- this.setState({ showModal: false })
- }
- render () {
- console.log(this.state.showModal) // Outputs true even after the hideModal() call
- return (<Components />)
- }
- }
Add Comment
Please, Sign In to add comment