Skip to content

Instantly share code, notes, and snippets.

@karenying
Last active November 22, 2020 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karenying/5b0558302cc22e28aaf0275c5d65cf7e to your computer and use it in GitHub Desktop.
Save karenying/5b0558302cc22e28aaf0275c5d65cf7e to your computer and use it in GitHub Desktop.
import { Link, useParams } from 'react-router-dom';
const Header = () => {
const { page } = useParams();
return (
<div className='header'>
<HeaderLink page='home' selected={page === 'home'} />
<HeaderLink page='about' selected={page === 'about'} />
<HeaderLink page='contact' selected={page === 'contact'} />
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment