Home > AI > Language > Javascript >

Document.querySelector()

You can use javascript code in the useEffect

  useEffect(() => {
        let expand = document.querySelector("#mn-admin-side .expand");
        let nav = document.querySelector("#mn-admin-side");
        let items = document.querySelectorAll("#mn-admin-side li");

        expand.addEventListener("click", () => {
            nav.classList.toggle("closed");
        });
        return () => {}
    })

Leave a Reply