Skip to content

Commit 03ce199

Browse files
committed
chore: useDebounce为什么面试的时候会紧张到闭包层都写错了,还是太生疏了、心态也得
1 parent 271f76b commit 03ce199

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

React/sandboxs/src/hooks/useBatch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function useBatch(fn, time) {
1212
fnRef.current = fn
1313
}, [fn])
1414

15-
// 别忘记清理计时器
15+
// 别忘记通过 useEffect 的 return 清理计时器
1616
useEffect(() => {
1717
return () => {
1818
if (timer.current) {

0 commit comments

Comments
 (0)