Last active
October 16, 2019 06:34
Revisions
-
Vincenius revised this gist
Oct 16, 2019 . 1 changed file with 0 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +0,0 @@ -
Vincenius revised this gist
Oct 16, 2019 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ onToggleArray = item => { this.setState(state => { const arr = state.arr.includes(item) ? arr.filter(i => i !== item) // remove item : [ ...arr, item ]; // add item return { arr, }; }); } -
Vincenius created this gist
Oct 16, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ function toggleArrayItem(arr, item) { arr.includes(item) ? arr.filter(i => i !== item) // remove item : [ ...arr, item ]; // add item }