[docs] Remove generic spread, Object.assign mentions
This commit is contained in:
parent
f5a9ea8e03
commit
fc91d2fd72
|
@ -49,23 +49,4 @@ You can use this multiple times or combine it with other attributes. The specifi
|
||||||
|
|
||||||
## What's with the weird `...` notation?
|
## What's with the weird `...` notation?
|
||||||
|
|
||||||
The `...` operator (or spread operator) is already supported for [arrays in ES6](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). There is also an ES7 proposal for [Object Rest and Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread).
|
The `...` operator (or spread operator) is already supported for [arrays in ES6](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). There is also an ES7 proposal for [Object Rest and Spread Properties](https://github.com/sebmarkbage/ecmascript-rest-spread). We're taking advantage of these supported and developing standards in order to provide a cleaner syntax in JSX.
|
||||||
|
|
||||||
In fact, you can already use this in our code base as an experimental syntax:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var oldObj = { foo: 'hello', bar: 'world' };
|
|
||||||
var newObj = { ...oldObj, foo: 'hi' };
|
|
||||||
console.log(newObj.foo); // 'hi';
|
|
||||||
console.log(newObj.bar); // 'world';
|
|
||||||
```
|
|
||||||
|
|
||||||
Merging two objects can be expressed as:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var ab = { ...a, ...b };
|
|
||||||
```
|
|
||||||
|
|
||||||
> Note:
|
|
||||||
>
|
|
||||||
> Use the [JSX command-line tool](http://npmjs.org/package/react-tools) with the `--harmony` flag to activate the experimental ES7 syntax.
|
|
||||||
|
|
Loading…
Reference in New Issue