[英]Using a debounced search handler with antd select
I am trying to create a wrapper component around antd's Select, that adds a debounced function to handle search input.我正在尝试围绕 antd 的 Select 创建一个包装器组件,它添加了一个去抖动的 function 来处理搜索输入。 I am using lodash's debounce util function.
我正在使用 lodash 的 debounce util function。
However I run into a bug where:但是我遇到了一个错误:
I have created a minimal sandbox that replicates this behavior here: https://codesandbox.io/s/vigorous-glade-495f2z?file=/src/Select.jsx .我在这里创建了一个复制此行为的最小沙箱: https://codesandbox.io/s/vigorous-glade-495f2z?file=/src/Select.jsx 。
Remove the searchValue
props from the Select
component.从
Select
组件中删除searchValue
属性。
const propsToSelect = {
...props,
style: { width: "300px" },
onSearch: searchHandlerWithDebounce,
filterOption: false,
options: []
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.