joygabriel21

Full Code of State

Jan 20th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. import React, { Component } from 'react'
  2.  
  3. export class ReactDemo extends Component {
  4. constructor () {
  5. super()
  6. this.state = {
  7. username: ''
  8. }
  9. }
  10.  
  11. loggingIn () {
  12. this.setState({
  13. username: 'joy'
  14. })
  15. }
  16.  
  17. loggingOut () {
  18. this.setState({
  19. username: ''
  20. })
  21. }
  22.  
  23. render () {
  24. <div> <Login onClick={this.loggingIn} />
  25. <Logout onClick={this.loggingOut} />
  26. </div>
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment