From 0cb0c527976a36c31991db900cb9e95aa3297411 Mon Sep 17 00:00:00 2001 From: mnsinri Date: Fri, 8 Nov 2024 21:40:14 +0900 Subject: [PATCH] =?UTF-8?q?=E5=BF=9C=E6=80=A5=E5=87=A6=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/inViewContainer/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/inViewContainer/index.tsx b/src/components/inViewContainer/index.tsx index 77d1c7c..8e21a0e 100644 --- a/src/components/inViewContainer/index.tsx +++ b/src/components/inViewContainer/index.tsx @@ -21,11 +21,15 @@ export const InViewContainer = ({ const [renderDataIdx, setRenderDataIdx] = useState(1); const ref = useRef(null!); + useEffect(() => { + console.log("renderDataIdx", renderDataIdx); + }, [renderDataIdx]); + useEffect(() => { const observer = new IntersectionObserver(([entry]) => { if (!entry.isIntersecting) return; - setRenderDataIdx((n) => ++n); + setRenderDataIdx((n) => n + 2); }); setTimeout(() => observer.observe(ref.current), 0);