title: How to set default className in react router link changed
body: <p>I have menu component , and I checked for active class with current <code>location.path</code> that set in <code>state</code> . If current url is <code>localhost/News</code> , the li with <code>News</code> must have <code>active</code> class and I done it. But I want to set default <strong>active class</strong> to li first child in <strong>isActive function</strong> if url is <code>localhost</code> only !! How can I achieve it ?</p>
  
  <pre><code>render() {
    const menu = ['Home','News','Technology']
  
    const isActive = (name) =&gt; (      
      this.state.activeName === '/' + name ? 'active' : ''
    )
  
    return (
      &lt;nav&gt;
        &lt;div className="nav-wrapper light-blue lighten-1 row"&gt;
          &lt;ul id="nav-mobile" className="hide-on-med-and-down col m10"&gt;
            {
              menu.map((i) =&gt; (
                &lt;li className={isActive(i)} key={i}&gt;&lt;a href={'/'+i}&gt;{i}&lt;/a&gt;&lt;/li&gt;
              ))
            }
          &lt;/ul&gt;
          &lt;a href="#" className="col m2 right-align"&gt;Logo&lt;/a&gt;
        &lt;/div&gt;
      &lt;/nav&gt;
    )
  }
  </code></pre>