Skip to content

Instantly share code, notes, and snippets.

@Ryanlucass
Created February 28, 2023 03:18
Show Gist options
  • Save Ryanlucass/1e8325e18a57364516483dffc541aac5 to your computer and use it in GitHub Desktop.
Save Ryanlucass/1e8325e18a57364516483dffc541aac5 to your computer and use it in GitHub Desktop.
Debounce function
when you need render a component and add countdown em your debounce functions, you need make this.
the react native reserve state
const debounceFunction = useCallback(
debounce(() => {
//call yor function
},300),[]
);
const handleAdd = useCallback(() => {
setCount(count + 1);
debounceFunction();
}, [count, debounceFunction])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment