Skip to content

Commit

Permalink
応急処置 (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsinri authored Nov 8, 2024
1 parent 0afbc01 commit 243e9eb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/inViewContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ export const InViewContainer = <T,>({
const [renderDataIdx, setRenderDataIdx] = useState<number>(1);
const ref = useRef<HTMLDivElement>(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);
Expand Down

0 comments on commit 243e9eb

Please sign in to comment.