Created
January 17, 2022 08:44
-
-
Save petrosDemetrakopoulos/08ad78540dbcf6e770819e86e4470183 to your computer and use it in GitHub Desktop.
handleCheckboxChange function
This file contains hidden or 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
function handleCheckboxChange(key: string) { | |
let sel = state.selections | |
let find = sel.indexOf(key) | |
if (find > -1) { | |
sel.splice(find, 1) | |
} else { | |
sel.push(key) | |
} | |
setState({ | |
selections: sel, | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment