Skip to content

Instantly share code, notes, and snippets.

@Bernardstanislas
Last active October 1, 2015 11:57
Show Gist options
  • Save Bernardstanislas/385ceaa831e3e6d8570b to your computer and use it in GitHub Desktop.
Save Bernardstanislas/385ceaa831e3e6d8570b to your computer and use it in GitHub Desktop.
Autocomplete
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var pickList = nextProps.pickList;
var code = nextProps.code;
var newValue = nextProps.value;
var value = this._getValueFromCode(code, pickList);
if ('' === value && newValue) {
value = newValue;
}
this.setState({ value: value });
this._awesomeplete._list = this._extractListFromData(pickList);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment