Replies: 1 comment
-
const location = useLocation();
useEffect(() => {
const navbarCollapse = document.getElementById("AAA");
if (navbarCollapse) {
navbarCollapse.classList.add("hidden");
}
console.log("URL changed:", location.pathname);
}, [location.pathname]);
...
<NavbarCollapse id="AAA"> Using this "trick" helps achieve the goal, but it makes the minus button unstable (you have to click it twice to open) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to let me automatically close the navbar when I click the navbar to switch the page to the next page?
Beta Was this translation helpful? Give feedback.
All reactions