Guest User

Untitled

a guest
Oct 19th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class MyComponent extends Component {
  2. constructor (props) {
  3. super(props)
  4.  
  5. this.state = {
  6. showModal: false
  7. }
  8.  
  9. this.showModal = this.showModal.bind(this)
  10. this.hideModal = this.hideModal.bind(this)
  11. }
  12. showModal () {
  13. this.setState({ showModal: true })
  14. }
  15. hideModal () {
  16. this.setState({ showModal: false })
  17. }
  18. render () {
  19. console.log(this.state.showModal) // Outputs true even after the hideModal() call
  20.  
  21. return (<Components />)
  22. }
  23. }
Add Comment
Please, Sign In to add comment