React.js -- How to pass properties object to child component?

Solution 1:

Apparently transferPropsTo is being deprecated. With recent versions of React you can use JSX spread attributes:

return <tileSimple {...tile} />;

More info about this here: Deprecating transferPropsTo

Solution 2:

For those use cases, the easiest thing is to fallback to the JS API instead of JSX.

return tileSimple(tile);

To understand why it works, look at the generated version of the version you want using the JSX Compiler tool ( http://facebook.github.io/react/jsx-compiler.html )

<tileSimple vsize = {tile.vsize} hsize = {tile.hsize} content = {tile.content}/>;
tileSimple( {vsize:  tile.vsize, hsize:  tile.hsize, content:  tile.content});

Solution 3:

You can actually just do the following in your render

return this.transferPropsTo(<tileSimple />);