1import React, { useCallback } from 'react';
2import _ from 'lodash';
3
4const MyComponent = ({ data, handleInputChange }) => {
5 const debounceFunc = useCallback(
6 _.debounce(e => handleInputChange(e), 500),
7 []
8 );
9
10 const handleChange = e => {
11 debounceFunc(e);
12 };
13 return <TextInput data={data} onChange={handleChange} />;
14};
15
16export default MyComponent;