Last active
April 29, 2016 23:29
-
-
Save Dindaleon/deea3b56e901559422e1dd6a7b3af9dc to your computer and use it in GitHub Desktop.
Add/remove item to/from array without mutating it
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
// Add item to array | |
// use concat or spread operator | |
// Remove item from array | |
// user slice | |
// Replace item in array | |
// | |
// Source: https://egghead.io/lessons/javascript-redux-avoiding-array-mutations-with-concat-slice-and-spread |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment