Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

hide header in next js page

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;
Comment

PREVIOUS NEXT
Code Example
Javascript :: subject in angular service file 
Javascript :: what does react js allows us to do 
Javascript :: format file using jq 
Javascript :: how to send Flutter Color as json || convert String to Color Flutter 
Javascript :: unique elements 
Javascript :: Storing Values With Assignment Operators 
Javascript :: merge json data in main.go in golang 
Javascript :: nestjs cors dotnot woriking 
Javascript :: react native red Oval bubble 
Javascript :: find duplicate objects in array js 
Javascript :: tailwind intenseness react 
Javascript :: easyui treegrid check if row exists 
Javascript :: load js on only homepage wp 
Javascript :: jquery input valueadd 
Javascript :: normalizedList.flatMap is not a function vue draggable 
Javascript :: js detect where function call came from 
Javascript :: whatisjsx 
Javascript :: color blur in echart 
Javascript :: AJAX XML - update new live data and prevent returning old chache data 
Javascript :: angular 10 filter date time 
Javascript :: lieke 
Javascript :: string in vue.js 
Javascript :: caeser psypher javascript 
Javascript :: how to add array of object in class in javascript 
Javascript :: print array elements in new line javascript 
Javascript :: check if date is valid js 
Javascript :: how to restrict page leave in javascript 
Javascript :: multiple parameters in url Servlet 
Javascript :: ionic react exit app 
Javascript :: enzym.debug 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =