Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- state = {
- form :[
- {name: 'email', valid: true, value: ''},
- {name: 'password', valid: true, value: ''}
- ]
- }
- <Button disabled={!this.isValid()}>Submit</Button>
- isValid = () =>{
- const { form } = this.state
- let valid = true
- for(let input of form){
- if(input.value === '' || !input.valid)
- valid = false
- }
- return valid
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement