Hi Team,
I have a ComboBox that and my use case is that when a user types into it, it will send a request to a server to get the search results and set the data, for the user to then select. So a server filter, kind of.
The problem is that onFilterChange is triggered on each keypress which in turn sends a request to the server each time. I would like to debounce the request to the server until the user has stopped typing, but I cannot find a debounce function that works. I know how to use useEffect and useRef, but the refVarialbe.current doesnt update on filterChange, only on value change. Which is not my use-case.
Attempts: https://stackblitz.com/edit/react-pht5mn?file=app%2Fmain.jsx
Has anyone had any success with this?
Please advise.
Thanks,
Grant