Skip to content

Instantly share code, notes, and snippets.

@mike-at-redspace
Forked from remy/ActiveLink.js
Created September 16, 2021 08:01
Show Gist options
  • Save mike-at-redspace/371f0a065f44fe86bc09ff72a7de95f5 to your computer and use it in GitHub Desktop.
Save mike-at-redspace/371f0a065f44fe86bc09ff72a7de95f5 to your computer and use it in GitHub Desktop.
Next.js version of `activeClassName` support.
import Link from './Link'; // our version of link

export default () => (
  <header className="Header">
    <nav>
      <Link activeClassName="active" href="/">
        <a className="some-other-class">Home</a>
      </Link>
      <Link activeClassName="active" href="/about">
        <a>About</a>
      </Link>
      <Link activeClassName="active" href="/contact">
        <a>Contact</a>
      </Link>
    </nav>
  </header>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment