Hello everyone, I am having an unusual error that I can’t track down.
This is my code for my nav-bar
But when I click the navbar I get the error message that is in the title.
I have never really worked with react and vanilla JS together like this, so i am thinking it’s a simple mistake.
Thanks in advance for your expertise.
var bars = document.getElementById("nav-action");
var nav = document.getElementById("nav");
document.addEventListener("click", barClicked, false);
function barClicked() {
bars.classList.toggle('active');
nav.classList.toggle('visible');
}
export const Navigation = () => (
<div
className="homepage"
>
<div class="bars" id="nav-action">
<span class="bar"> </span>
</div>
<nav id="nav">
<ul>
<li class="shape-circle circle-one"><a href="#">Contact</a></li>
<li class="shape-circle circle-two"><a href="#">Blog</a></li>
<li class="shape-circle circle-three"><a href="#">Work</a></li>
<li class="shape-circle circle-five">
<a href="#">Home</a>
</li>
</ul>
</nav>
</div>
);