--- id: transferring-props title: Transferring Props permalink: transferring-props.html prev: reusable-components.html next: forms.html --- It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details. You can use [JSX spread attributes](/react/docs/jsx-spread.html) to merge the old props with additional values: ```javascript ``` If you don't use JSX, you can use any object helper such as ES6 `Object.assign` or Underscore `_.extend`: ```javascript React.createElement(Component, Object.assign({}, this.props, { more: 'values' })); ``` The rest of this tutorial explains best practices. It uses JSX and experimental ES7 syntax. ## Manual Transfer Most of the time you should explicitly pass the properties down. That ensures that you only expose a subset of the inner API, one that you know will work. ```javascript var FancyCheckbox = React.createClass({ render: function() { var fancyClass = this.props.checked ? 'FancyChecked' : 'FancyUnchecked'; return (
{this.props.children}
); } }); React.render( Hello world! , document.getElementById('example') ); ``` But what about the `name` prop? Or the `title` prop? Or `onMouseOver`? ## Transferring with `...` in JSX > NOTE: > > In the example below, the `--harmony ` flag is required as this syntax is an experimental ES7 syntax. If using the in-browser JSX transformer, simply open your script with `