skip to Main Content

Javascript – Working of useSearchDebounce custom react hook

I found this code from this answer https://stackoverflow.com/a/68780417/26420821 How does it work? export function useSearchDebounce(delay = 350) { const [search, setSearch] = useState(null); const [searchQuery, setSearchQuery] = useState(null); useEffect(() => { const delayFn = setTimeout(() => { console.log("setTimeout called"); setSearch(searchQuery);…

VIEW QUESTION
Back To Top
Search