From d58e9d0ed6c213ad372379d50941daceb3affb4b Mon Sep 17 00:00:00 2001 From: Cory House Date: Tue, 16 Jun 2020 13:59:11 -0500 Subject: [PATCH] Update object spread syntax description (#3036) Removed reference to it being experimental. Changed link to MDN. Mentioned version where it was added. --- content/docs/optimizing-performance.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/docs/optimizing-performance.md b/content/docs/optimizing-performance.md index 030cb059e..72041f332 100644 --- a/content/docs/optimizing-performance.md +++ b/content/docs/optimizing-performance.md @@ -371,7 +371,7 @@ function updateColorMap(colormap) { `updateColorMap` now returns a new object, rather than mutating the old one. `Object.assign` is in ES6 and requires a polyfill. -There is a JavaScript proposal to add [object spread properties](https://github.com/sebmarkbage/ecmascript-rest-spread) to make it easier to update objects without mutation as well: +[Object spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) makes it easier to update objects without mutation as well: ```js function updateColorMap(colormap) { @@ -379,6 +379,8 @@ function updateColorMap(colormap) { } ``` +This feature was added to JavaScript in ES2018. + If you're using Create React App, both `Object.assign` and the object spread syntax are available by default. When you deal with deeply nested objects, updating them in an immutable way can feel convoluted. If you run into this problem, check out [Immer](https://github.com/mweststrate/immer) or [immutability-helper](https://github.com/kolodny/immutability-helper). These libraries let you write highly readable code without losing the benefits of immutability.