I am having problems with the reactors component using a mixin and dynamic children onclick event. I have a feedback component, which is based on some of the passphrases passed to it, will push additional response components into an array. Then in the last return statement from the render method, add these components to the content These dynamic children define an onClick event in their render method and use the handler from the mixer. However, I do not get kids on the program to fire the handler only on parents. However, if these children have been made difficult, then onClick handler is really a fire Any thoughts that I am doing wrong? Actual example:
Mixin:
var eventhandler = {handleclick: function (e) {console.log ('click', this.name); }};
Component and its original components:
var foo = React.createClass ({mixins: [eventhandler], name: '', ... render : Function () {children_comps = [], if (some condition) {children_comps.push (& lt; ChildComponent id = {this.props.id} / & gt;)}} Return (& lt; div onClick = {this .handleClick} & gt; & lt; p & gt; asdf & lt; / p & gt; {children_comps} & lt; / div & gt;)}}
Children:
var ChildComponent = React.createClass ({mixins: [eventhandler], name: '', ... render: function () {return ();}};
No comments:
Post a Comment