From 0278f9b9390625bf181f039205b2b34d94ee3836 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Wed, 27 Jul 2022 22:23:17 +0800 Subject: [PATCH] fix: fix count don't work (#1784) * fix: fix count --- packages/hooks/src/useMutationObserver/demo/demo1.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hooks/src/useMutationObserver/demo/demo1.tsx b/packages/hooks/src/useMutationObserver/demo/demo1.tsx index a157084ba1..d92a09933f 100644 --- a/packages/hooks/src/useMutationObserver/demo/demo1.tsx +++ b/packages/hooks/src/useMutationObserver/demo/demo1.tsx @@ -15,7 +15,7 @@ const App: React.FC = () => { useMutationObserver( (mutationsList) => { - mutationsList.forEach(() => setCount(count + 1)); + mutationsList.forEach(() => setCount((c) => c + 1)); }, ref, { attributes: true },