Skip to content

Instantly share code, notes, and snippets.

@HumphreyHuang
Forked from remy/ActiveLink.js
Created October 4, 2019 15:10
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 HumphreyHuang/2f12424dc553e9841b7e40aa5eda46ea to your computer and use it in GitHub Desktop.
Save HumphreyHuang/2f12424dc553e9841b7e40aa5eda46ea 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