Skip to content

Instantly share code, notes, and snippets.

@cbandara
Created June 5, 2019 03:08
Show Gist options
  • Save cbandara/4adb1e0fa80f220a05bf4fb7b1591cbc to your computer and use it in GitHub Desktop.
Save cbandara/4adb1e0fa80f220a05bf4fb7b1591cbc to your computer and use it in GitHub Desktop.
react navigation bar example
import React from 'react';
import './navigation-bar.css';
// The NavigationBar component goes here. It should be the default export.
export default function NavigationBar(props) {
const links = props.links.map((link, index) => (
<li key={index}>
<a href={link.href}>
{link.text}
</a>
</li>
));
return (
<div className="navigation-bar">
<h1>{props.title}</h1>
<nav className="navigation-bar-nav">
<ul>
{links}
</ul>
</nav>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment