Created
February 28, 2023 03:18
-
-
Save Ryanlucass/1e8325e18a57364516483dffc541aac5 to your computer and use it in GitHub Desktop.
Debounce function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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