diff --git a/src/components/ads/index.tsx b/src/components/ads/index.tsx index e646be30..38832ad9 100644 --- a/src/components/ads/index.tsx +++ b/src/components/ads/index.tsx @@ -1,9 +1,13 @@ import Script from "next/script"; -import { useEffect, useRef } from "react"; +import { useEffect, useRef, useState } from "react"; export const Ads = () => { const initialized = useRef(false); + const [loaded, setLoaded] = useState(false); useEffect(() => { + if (!loaded) { + return; + } if (initialized.current) { return; } @@ -16,13 +20,16 @@ export const Ads = () => { } catch (e) { console.error(e); } - }, []); + }, [loaded]); return ( <>