I'm a beginner with Next.js and React framework. My question is regarding toggling a class. Here's my attempt in plain JS:
function toggleNav() {
var element = document.getElementById("nav");
element.classList.toggle("hidden");
element.classList.toggle("flex")
element.classList.toggle("bg-slate-900")
var toggler = document.getElementById("toggleNav");
toggler.classList.toggle("false");
toggler.classList.toggle("rotate-180");
}
I'm using Next.js in combination with TailwindCSS.