I am having **n** number of dropdown menus in React JS. When I am clicking **nth** menu item, I want to open the corresponding dropdown menu. But what I am getting now is, on clicking a menu item, all the dropdowns are getting opened. How this can be achieved?

```
class Menubar extends React.Component {
  constructor() {
    super();
    this.state = {
      clicked: false
    };
    this.handleClick = this.handleClick.bind(this);
    this.handleOutsideClick = this.handleOutsideClick.bind(this);
  }

  componentWillMount() {
        document.addEventListener('click', this.handleOutsideClick, false);
    }

    componentWillUnmount(){
        document.removeEventListener('click', this.handleOutsideClick, false);
    }
  handleClick() {
    this.setState({clicked: !this.state.clicked});
  }
  handleOutsideClick(event){
        if (!this.refs.megaMenu.contains(event.target)) {
      this.setState({
                clicked: false
            });
        } 
  }
  render() {
    return (
      <div className="container">
        <div className="menu-bar">

          <div className="menu-bar-item" ref="megaMenu">
            <a className="menu-bar-link" href="#" onClick={this.handleClick}>First Menu</a>
            <div className={"mega-menu"+" "+this.state.clicked}>
              <div className="mega-menu-content">
                <p>First Menu</p>
              </div>
            </div>
          </div>

          <div className="menu-bar-item" ref="megaMenu">
            <a className="menu-bar-link" href="#" onClick={this.handleClick}>Second Menu</a>
            <div className={"mega-menu"+" "+this.state.clicked}>
              <div className="mega-menu-content">
                <p>Second Menu</p>
              </div>
            </div>
          </div>

          <div className="menu-bar-item" ref="megaMenu">
            <a className="menu-bar-link" href="#" onClick={this.handleClick}>Third Menu</a>
            <div className={"mega-menu"+" "+this.state.clicked}>
              <div className="mega-menu-content">
                <p>Third Menu</p>
              </div>
            </div>
          </div>

          <div className="menu-bar-item" ref="megaMenu">
            <a className="menu-bar-link" href="#" onClick={this.handleClick}>Fourth Menu</a>
            <div className={"mega-menu"+" "+this.state.clicked}>
              <div className="mega-menu-content">
                <p>Fourth Menu</p>
              </div>
            </div>
          </div>

        </div>
      </div>
    );
  }
}

ReactDOM.render(
  <Menubar />,
  document.getElementById('example')
);

```

[Codepen Demo Here](http://codepen.io/sivadass/pen/xONkgR)