Last active
November 14, 2016 14:57
-
-
Save osmelmora/eb46bc2665c3255b109b31e56427b37d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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