const [scroll, setScroll] = useState(false); useEffect(() => { window.addEventListener("scroll", () => { setScroll(window.scrollY > 50); }); }, []); className={scroll ? "bg-black" : "bg-white"}
const [scroll, setScroll] = useState(false); useEffect(() => { window.addEventListener("scroll", () => { setScroll(window.scrollY > 50); }); }, []); className={scroll ? "bg-black" : "bg-white"}