The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

transferPropsTo [DEPRECATED]

transferPropsTo [DEPRECATED]

3:30
**THIS METHOD HAS BEEN DEPRECATED** the `transferPropsTo` method lets you easily push properties into your components to easily customize attributes.
Watch this lesson now
Avatar
egghead.io

the transferPropsTo method lets you easily push properties into your components to easily customize attributes.

Avatar
Nicolas

So in this exemple, I guess the href is also transferred to the glyficon, is it ?

Avatar
Joseph

No. The props are only transferred to the first component.

Example:
this.transferPropsTo(<span><b><i>xxx</i></span>)

Here only the span component would get the props.

This also translates to:
this.transferPropsTo(React.DOM.span(null, React.DOM.b(null, React.DOM.i(null, "xxx"))))

So transferPropsTo is only concerned about the first argument, in this case <span> or React.DOM.span, knowing nothing about what might be nested further.

In reply to Nicolas
Avatar
Dean

I came across something similiar and I am curious if it behaves and is the new way to transferProps...

so, instead of "transferPropsTo", you'd use "{...this.props}" ?

In reply to egghead.io
Avatar
Joseph

Dean,

this.transferPropsTo is being deprecated in future versions of React. The JSX spread operator you are using here is the correct way to transfer props to a child component going forward in JSX. There is not yet a clear way to do this in pure Javascript other than using Object.assign, which is lacking browser support at the moment.

We're always updating the "React Fundamentals" lessons to reflect the ever-changing state of React, but in the meantime I highly recommend you checkout What's new in React v0.12.0 here: https://egghead.io/lessons/react-what-s-new-and-different-in-react-v0-12-0

In reply to Dean
Avatar
Wei-Ting

Any update for this? transferPropsTo is deprecated. Thanks

Avatar
David

Would be great if this video could be removed/updated. Reading the documentation on https://gist.github.com/sebmarkbage/a6e220b7097eb3c79ab7 doesn't make much sense on getting this particular tutorial to work. I'm unable to understand how to append classes (transfer the props from one component to another).

I just spent an hour trying to get this particular tutorial to work referencing the gist and have no luck.

The video need not be updated, but a comment from the author with a code snippet would do enough, then we could simply draw the connection along with the official docs.

Avatar
Joel

Joe commented above (still valid). I've added some additional signage around the lesson to indicated that this has ben DEPRECATED

It doesn't work. Move along :>

In reply to David
Avatar
Lakshmi Narayana Sastry Marthi

hi, what is the text editor used in these videos?

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?