text: import React, { useState, useEffect } from "react";
  
  import { Link as ScrollLink, animateScroll as scroll } from "react-scroll";
  
  const Layout = (props) => {
    const [scrollTop, setScrollTop] = useState(false);
  
    const handleScrollTop = () => {
      if (window.scrollY > 70) {
        setScrollTop(true);
      } else if (window.scrollY < 70) {
        setScrollTop(false);
      }
    };
  
    useEffect(() => {
      window.addEventListener("scroll", handleScrollTop);
      return () => {
        window.removeEventListener("scroll", handleScrollTop);
      };
    });
    return (
      <div>
        <div className="page-wrapper">{props.children}</div>
  
        {scrollTop === true ? (
          <ScrollLink
            to="home"
            smooth={true}
            duration={500}
            className="scroll-to-top"
          >
            <i className="fa fa-angle-up"></i>
          </ScrollLink>
        ) : null}
      </div>
    );
  };
  
  export default Layout;
  