Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var Select2 = React.createClass({
componentDidMount: function() {
$(this._ref).select2({data: this.props.items});
},
render: function() {
return (
<select
ref={
function(input) {
this._ref = input;
}
}>
</select>
);
},
componentDidUpdate: function() {
$(this._ref).select2('destroy');
$(this._ref).select2({data: this.props.items});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment