react 防抖文本框
适用于输入值的时候调接口等异步操作
如果想要在该input上绑定value属性的话行不通
import React from 'react'
import { Input } from 'antd';
import debounce from 'lodash/debounce'
const DebounceInput = (props) => {
const { onChange } = props;
const debounceChange = debounce(onChange, 1000)
const handleChange = (e) => {
debounceChange(e.target.value)
}
return <Input {...props} onChange={handleChange} />
}
export default DebounceInput;