Browse Source

Merge pull request #3625 from dmin/patch-1

Docs: Fix example JSX output
main
Jim 10 years ago
parent
commit
4ee9f2bef5
  1. 4
      docs/06-transferring-props.md

4
docs/06-transferring-props.md

@ -11,13 +11,13 @@ It's a common pattern in React to wrap a component in an abstraction. The outer
You can use [JSX spread attributes](/react/docs/jsx-spread.html) to merge the old props with additional values: You can use [JSX spread attributes](/react/docs/jsx-spread.html) to merge the old props with additional values:
```javascript ```javascript
return <Component {...this.props} more="values" />; <Component {...this.props} more="values" />
``` ```
If you don't use JSX, you can use any object helper such as ES6 `Object.assign` or Underscore `_.extend`: If you don't use JSX, you can use any object helper such as ES6 `Object.assign` or Underscore `_.extend`:
```javascript ```javascript
return Component(Object.assign({}, this.props, { more: 'values' })); React.createElement(Component, Object.assign({}, this.props, { more: 'values' }));
``` ```
The rest of this tutorial explains best practices. It uses JSX and experimental ES7 syntax. The rest of this tutorial explains best practices. It uses JSX and experimental ES7 syntax.

Loading…
Cancel
Save