0
我是一個新手反應,我試圖做一個「搜索」,我試圖節流輸入。但它不起作用。請你糾正我在哪裏做錯了?反應油門不起作用
render() {
const { value, suggestions } = this.state;
const inputProps = {
placeholder: 'Try me! Search for iPad, iPhone',
value,
onChange: throttle(150, this.onChange), //DOESNT WORK :(
};
return (
<Row>
<Col grow={false} padding={0}>
<i className='ion-ios-search-strong'></i>
</Col>
<Col padding={0}>
<Autosuggest suggestions={suggestions}
onSuggestionsUpdateRequested={this.onSuggestionsUpdateRequested}
getSuggestionValue={this.getSuggestionValue}
renderSuggestion={this.renderSuggestion}
inputProps={inputProps} />
</Col>
</Row>
);
}
onChange(event, { newValue }) {
//_.throttle(() => { this.getValue(newValue) } , 500); //DOESNT WORK EITHER :(
this.getValue(newValue);
this.setState({
value: newValue
});
}