react函數式組件中使用lodash的debounce
import _ from 'lodash'
<Input style={{ marginBottom: 16 }} maxLength={25} onChange={userChange} />
const userChange = (e: any) => {
callAjax(e.target.value)
}
const getMember = (value: any) => {
fetchMember(value); // 最終的獲取ajax數據的方法
}
const callAjax = _.debounce(getMember, 300)