0

so we can achieve this in react-router V6 by using useLocation click to see doc. . just you need to wrap your own navbar component code with this condition :-

{ location.pathname != '/login' && your navbar code }

1st go to your Navbar.js file :-

import { useLocation } from "react-router-dom";

function MuiNavbar() {
  let location = useLocation();

 return (
    <>
   {
    location.pathname != '/login' && 
            /* now just write your navbar code here  */
   }
</> )

0 Answers0