title: Show hide content onClick in react JS
body: <p>A have an array objects in React JS and I want to loop through it.</p>
  
  <p>My code is as follows :</p>
  
  <pre><code>let data = [
      {make: "Volkswagen", models: ["Golf", "Passat", "Polo", "Tiguan"]},
      {make: "Skoda", models: ["Fabia", "Octavia", "Superb"]},
      {make: "Audi", models: ["A1", "A3", "A5", "Q3", "Q5"]}
  ];    
  
  export default class makeModel extends React.Component {
      constructor(props) {
          super(props);
          this.state = {
              show: false,
              make: null
          }
      }
  
      handleMake(event){
          event.preventDefault();
          this.setState({make: event.target.name, show: !this.state.show});
      }
  
      render() {
          const language = this.props.language;
          let style = {display: "none"};
  
          if(this.state.show) style = {display: "block"};
          return (
              &lt;div&gt;
                  &lt;div className="priceTitle"&gt;{language.makeAndModel}&lt;/div&gt;
                  {data.map( (car, i) =&gt; {
                      return (
                          &lt;div key={i} className="makeModel"&gt;
                              &lt;Link to="/" className="make" name={car.make} onClick={this.handleMake.bind(this)}&gt;{car.make}&lt;/Link&gt;
                              &lt;div className="models" style={style}&gt;
                                  {car.models.map((m, i) =&gt; {
                                      if(car.models.indexOf(m) &gt; -1 &amp;&amp; car.make === this.state.make){
                                          return &lt;div key={i}&gt;{m}&lt;/div&gt;
                                      }
                                  })}
                              &lt;/div&gt;
                          &lt;/div&gt;
                      )
                  })}
              &lt;/div&gt;
          );
      }
  }
  </code></pre>
  
  <p>I want to show the list of all makes. And then on click I want to show than all models of that make.</p>
  
  <p>My code works. But onClick there are all three divs with class models shown. But only in the clicked one the models are shown. How to hide all those div's with class model and show only the clicked one?</p>
  
  <p>And generally, is there any better way to do it? </p>