The Debounce function must be defined somewhere outside the render method, because it must reference the same instance of the function every time you call it as opposed to creating a new instance, as it is now when you put it in the onChangeText handler.
The most common place to define the debounce function is directly on the component object. Here is an example:
class MyComponent extends React.Component { constructor() { this.onChangeTextDelayed = _.debounce(this.onChangeText, 2000); } onChangeText(text) { console.log("debouncing"); } render() { return <Input onChangeText={this.onChangeTextDelayed} /> } }
source share