Upgrading my portfolio in react and having an issue with the href not working for my react app. Here is the NavBar code. Live site is here. https://cigiportfolio.netlify.app/
I believe that it has to do with the use state in combination with the scrollspy. Maybe I have been looking at it too long to figure out the details
import Scrollspy from "react-scrollspy";
import Social from "../SocialTwo";
import { NavLink } from "react-router-dom";
const Header = () => {
const [click, setClick] = useState(false);
const handleClick = () => setClick(!click);
const [navbar, setNavbar] = useState(false);
const changeBackground = () => {
if (window.scrollY >= 80) {
setNavbar(true);
} else {
setNavbar(false);
}
};
window.addEventListener("scroll", changeBackground);
return (
<>
<div className="cigi_topbar">
<div className={navbar ? "topbar_inner opened" : "topbar_inner"}>
<div className="logo">
<NavLink to="/">
<img src="/img/logo/new/smCTGearonly.png" alt="partners brand" />
</NavLink>
</div>
{/* End logo */}
<div className="menu">
<Scrollspy
className="anchor_nav"
items={["home", "about", "portfolio", "skills", "contact"]}
currentClassName="current"
offset={-200}
>
<li>
<a href="#home">Home</a>
</li>
<li>
<a href="#about">About</a>
</li>
<li>
<a href="#portfolio">Portfolio</a>
</li>
<li>
<a href="#skills">Skills</a>
</li>
<li>
<a href="#contact">Contact</a>
</li>
</Scrollspy>
</div>
{/* End menu */}
</div>
</div>