react router NavLink active code example

Example 1: how to make react router Link active

const Router = () => (
  <BrowserRouter>
    <div>
      <Nav>
        <NavLink exact={true} activeClassName='is-active' to='/'>Home</NavLink>
        <NavLink activeClassName='is-active' to='/about'>About</NavLink>
      </Nav>

      <Match pattern='/' exactly component={Home} />
      <Match pattern='/about' exactly component={About} />
      <Miss component={NoMatch} />
    </div>
  </BrowserRouter>
)

Example 2: why navlink in react router always active

<li> <NavLink exact to='/' activeClassName="active-link">Home</NavLink> </li>

Example 3: why navlink in react router always active

<li> <NavLink to='/' activeClassName="active-link" isActive={checkActive}>Home</NavLink> </li>