First, I'd encourage you to do all of this without using an obscured package layer. This will help you truly understand the flow, but nevertheless, here's how you can call a function when the input changes:
- debounce (only executes once when a user stops typing for 500ms)
- throttle (batches then executes every 500ms)
- normal (executes on every input update)
In this case, I just created a debounced function outside of the render method. This varies when using classes instead of hooks:
Hooks:
const handleSearch = debounce(searchText => { ... }, 500);
Classes (or you can debounce the class field in the constructor
, either work):
class Example extends Component {
handleSearch = debounce(searchText => { ... }, 500)
render = () => { ... }
}
Working example (type while the codesandbox console is open):

The differences between debounced, throttled, and normal execution:

Same as above, minus react-final-form
and react-final-form-listeners
(two less dependencies in your project!):
Working example (type while the codesandbox console is open):
