Question: How can I set the active class name of a Link for a path that contains an optional parameter?

Below are some details of what I am trying to achieve:

* A route in my application has a path that contains an optional URL parameter - eventId:

`<Route path="/sendInvite(/:eventId)" component={SendInviteContainer} />`
* In my main navigation component there is a `<Link/>` that points to /sendInvite path (without the optional param):

`<Link to="/sendInvite" activeClassName="active">Send Invite</Link>`

If the user accesses the path `/sendInvite`, the Link has now an active class set, which is the correct behavior for this case.

**However**, when the user accesses `/sendInvite/15` , the Link in my navigation that points to /sendInvite has no active class set.

Any ideas on how to set the Link to active with the optional parameter in the address bar?

Answer: 
You need to put you `/sendInvite(/:eventId)` under `/sendInvite` route

It should be something like this:-

```
<Route path="/sendInvite" component={container} >
     <Route path="/sendInvite(/:eventId)" component={SendInviteContainer} />
</Route>

```

This should keep you parent route active.

You can check out [here](https://github.com/reactjs/react-router/blob/master/examples/active-links/app.js), check for how users part is taken care off in router, it would solve your purpose.
Another *and better option in my opinion* would be `isActive`, example:

```
<NavLink
    to='path'
    className='whatever'
    isActive={() => window.location.hash.indexOf('sendInvite') > -1}>
    Title
</NavLink>

```