componentWillReceiveProps(nextProps) {
this.setState({ id: nextProps.id })
}
<Input ... onChange={this.change}>
change = () => {
console.log("WTF");
this.setState({ open: !this.state.open })
};
constructor(...args) {
super(...args);
this.state = {
open: false,
value: 'select'
};
this.change = this.change.bind(this)
}
...
handleChange(source, event){
// source содержит имя элемента, сгенерировавшего событие: Comp1 или Comp2
...
}
render(){
...
<OneComponent ... onSomeEvent={this.handleChange.bind(this, "Comp1"} />
<OtherComponent ... onAnotherEvent={this.handleChange.bind(this, "Comp2"} />
...
}
...
<?php echo do_shortcode('[articul]'); ?>
var Select = React.createClass({
getInitialState: function() {
return {
options: optionsService.getoptions()
};
},
renderOptions: function() {
return this.state.genres.map(function(genre, i){
return (
<option value={i} value={i}>Один</option>
)
})
},
render: function() {
return (
<select>
{ this.renderOptions() }
</select>
)
}
});