I\'m trying to use the throttle method from lodash in a functional component, e.g.:
const App = () => {
const [value, setValue
Using lodash's debounce function here is what I do:
import debounce from 'lodash/debounce'
// The function that we want to debounce, for example the function that makes the API calls
const getUsers = (event) => {
// ...
}
// The magic!
const debouncedGetUsers = useCallback(debounce(getUsers, 500), [])
In your JSX: