Created
November 30, 2018 11:35
-
-
Save blizzerand/506bd97c6e6685c3d8a88b28e4069420 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleCheckBox(e) { | |
const newSelection = e.target.value; | |
let newSelectionArray; | |
if(this.state.newUser.skills.indexOf(newSelection) > -1) { | |
newSelectionArray = this.state.newUser.skills.filter(s => s !== newSelection) | |
} else { | |
newSelectionArray = [...this.state.newUser.skills, newSelection]; | |
} | |
this.setState( prevState => ({ newUser: | |
{...prevState.newUser, skills: newSelectionArray } | |
}) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment