I like to send the attribute properties/props/state values from child component to parent component on an event fire onDrag
. I could not find proper documentation on this.
Here is my code:
/*** @jsx React.DOM */
var APP=React.createClass({
getInitialState:function()
{
return {url:'http://www.youtube.com/embed/XGSy3_Czz8k'}
},
handleDrag:function(vidurl)
{
alert(vidurl); //i need to get child component url here.
},
render:function(){
return <div>
<VideoFrame src={this.state.url} />
<hr/>
<videos handle={this.handleDrag(vidurl)} />
</div>
}
});
var VideoFrame=React.createClass({
render:function(){
return <div>
<iframe width="420" height="315" src={this.props.src}>
</iframe>
</div>
}
});
var videos=React.createClass({
getInitialState:function()
{
return {vidurl:'http://www.youtube.com/embed/XGSy3_Czz8k'}
},
render:function()
{
return <img src="http://upload.wikimedia.org/wikipedia/en/a/a6/Size_Small.PNG" onDrag={this.props.handle.bind(this.state.vidurl)}></img> //trying to send state value from here
}
});
React.renderComponent(<APP />, document.body);
I hope my code is clear.