Skip to content

Instantly share code, notes, and snippets.

@JoSuzuki
Created September 16, 2021 16:56
Show Gist options
  • Save JoSuzuki/7ed08a0abf2aa9aaf988b672f98a484e to your computer and use it in GitHub Desktop.
Save JoSuzuki/7ed08a0abf2aa9aaf988b672f98a484e to your computer and use it in GitHub Desktop.
[Dont add, subtract] Navbar example 1
const MyApp = () => {
return (
<div>
<Navbar
items={[
{
label: 'Home',
href: '/home',
},
{
label: 'Products',
href: '/products',
},
{
label: 'About',
href: '/about',
},
]}
/>
<Main />
</div>
);
};
const Navbar = ({ items }) => {
return (
<NavbarStyled>
{items.map(({ href, label }) => (
<Link href={href}>{label}</Link>
))}
</NavbarStyled>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment