mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
[docs] Remove generic spread, Object.assign mentions
This commit is contained in:
@@ -49,23 +49,4 @@ You can use this multiple times or combine it with other attributes. The specifi
|
||||
|
||||
## 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).
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user