-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Closed
Description
E.g, when I generate list of buttons, I want to assign every button to same array, which is accessible through this.refs. After that, I can perform operation on every button easily. Something like square bracket syntax <input type="text" name="input[]" /> in html.
var ButtonList = React.createClass({
render: function() {
return (
{this.props.buttons.map(function(button) {
return <MyButton ref="buttons[]" onClick={this.handleClick} label={button.label} />;
})}
);
},
handleClick: function() {
this.refs.buttons.forEach(function(button) {
// perform operation on button
});
}
});Metadata
Metadata
Assignees
Labels
No labels