import React, { useEffect, useState } from "react"; import Header from "./Components/Header/Header"; import MasonryLayout from "./Components/MasonryLayout/MasonryLayout"; import ContainerCard from "./Components/ContainerCard/ContainerCard"; import Contributors from "./Jsons/Contributors.json"; import Footer from "./Components/Footer/Footer"; import RandomContributors from "./Components/randomcontributor/RandomContributors"; const App = () => { const [showButton, setShowButton] = useState(false); const handleScrollToTop = () => { window.scrollTo({ top: 0, behavior: "smooth" }); }; const scrollToTopBtn = () => { return (

^

); }; useEffect(() => { const handleScroll = () => { const currentPosition = window.scrollY; setShowButton((prev) => currentPosition < 1000 ? (prev = false) : (prev = true) ); }; window.addEventListener("scroll", handleScroll); return () => { window.removeEventListener("scroll", handleScroll); }; }, []); return ( {scrollToTopBtn()}