Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. state = {
  2. form :[
  3. {name: 'email', valid: true, value: ''},
  4. {name: 'password', valid: true, value: ''}
  5. ]
  6. }
  7.  
  8. <Button disabled={!this.isValid()}>Submit</Button>
  9.  
  10. isValid = () =>{
  11. const { form } = this.state
  12. let valid = true
  13.  
  14. for(let input of form){
  15. if(input.value === '' || !input.valid)
  16. valid = false
  17. }
  18. return valid
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement