Last active
January 29, 2022 15:34
-
-
Save PaulieScanlon/1677fefceddbbc35b8083271d1f57616 to your computer and use it in GitHub Desktop.
Conditional Header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Fragment } from 'react'; | |
export const wrapPageElement = ({ element, props }) => { | |
const { | |
location: { pathname }, | |
} = props | |
return ( | |
<Fragment> | |
<header className={`${pathname === '/' ? 'some-class' : 'some-other-class'} `}> | |
<nav>...</nav> | |
</header> | |
<main>{element}</main> | |
</Fragment> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment