score:6

Accepted answer

You have to change state somehow. Button click, input change or even from a child component handler of some sort.

In this example, I'm using onClick in each li element that triggers such state change:

class App extends React.Component {
  constructor() {
    super()

    this.state = {
      activeItem: -1,
      items: ['All Projects', 'My Projects'],
    }
  }

  handleItemClick(index) {
    this.setState({
      activeItem: index,
    })
  }

  render() {
    return (
      <div>
        <ul className='bread list-inline'>
          {this.state.items.map((item, index) =>
            <li
              key={index}
              className={this.state.activeItem === index ? 'navigation--active' : ''}
              onClick={this.handleItemClick.bind(this, index)}
            >
              {item}
            </li>
          )}
        </ul>
      </div>
    )
  }
}

ReactDOM.render(
  <App />,
  document.getElementById('root')
)
ul > li {
  cursor: pointer;
}

li.navigation--active {
  text-decoration: underline;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"></div>

score:1

Let say your li is below

<li className={this.state.isActive ? 'navigation--active' : ''}>All projects</li>

Now change you li to this below LI and add OnClick function "liCkickFun"

    <li className='navigation--active' onClick={this.liCkickFun}>All projects</li>

Now in your component add below function

liCkickFun = (event) => {
  //check if clicked element has active class then remove it 
  //and if don't has class then add it
     if(event.target.classList.contains('navigation--active')){
       event.target.classList.remove('navigation--active');
     } else { 
       event.target.classList.add('navigation--active');         
     }
}

Hope this will help :)


Related Query

More Query from same tag