如何通过实例学习React中事件节流防抖-创新互联
这篇文章将为大家详细讲解有关如何通过实例学习React中事件节流防抖,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

节流
方法一
import Throttle from 'lodash-decorators/throttle';
export default class Search extends Component {
constructor(props) {
super(props)
this.handleSearch = this.handleSearch.bind(this);
}
handleSubmit = (e) => {
e.preventDefault();
this.handleSearch();
}
@Throttle(300)
handleSearch() {
...
}
render() {
return (


咨询
建站咨询
