diff --git a/pages/index.jsx b/pages/index.jsx index ea1a15b..3c3b8af 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -164,12 +164,9 @@ function ProjectCard({ json, basePath }) { ); } -import React, { useEffect } from "react"; - function Factbox({ fact, closer }) { - useEffect(() => { + if (typeof window !== "undefined") { const elements = document.querySelectorAll(".number"); - const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { @@ -193,18 +190,10 @@ function Factbox({ fact, closer }) { } }); }); - elements.forEach((element) => { observer.observe(element); }); - - return () => { - elements.forEach((element) => { - observer.unobserve(element); - }); - }; - }, []); - + } return (