ocultar cabeçalho na próxima página JS

import { Fragment } from "react";
import MainHeader from "./../layout/main-header";
import { useRouter } from "next/router";

function Layout(props) {
  const router = useRouter();

  const showHeader = router.pathname === "/admin" ? false : true;
  return (
    <Fragment>
        {showHeader && <MainHeader />}
        <main>{props.children}</main>
    </Fragment>
  );
}

export default Layout;
Nabila