Skip to content

Instantly share code, notes, and snippets.

@osmelmora
Last active November 14, 2016 14:57
Show Gist options
  • Save osmelmora/eb46bc2665c3255b109b31e56427b37d to your computer and use it in GitHub Desktop.
Save osmelmora/eb46bc2665c3255b109b31e56427b37d to your computer and use it in GitHub Desktop.
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