title: How can I hide particular element in react list?
body: <p>I want to hide a particular element in react list.</p>
  
  <p>This is how state looks like:</p>
  
  <pre><code> this.state = {
      lgShow: false,
      list: [ 
        { id:1, hidden: true },
        { id:2, hidden: true }
      ]
    };
  </code></pre>
  
  <p>This is how component looks like:</p>
  
  <pre><code>  props.list.map( result =&gt; (
       &lt;button onClick={toggle(result.id)}&gt; Hide &lt;/button&gt;
       { result.hidden &amp;&amp; &lt;div id={result.id}&gt; .... &lt;/div&gt;  }
    ))
  </code></pre>
  
  <p>I want to write function toggle which searches the id in App.js and change value of hidden for that id, something like this(Although I'm not able to setState() in this case).</p>
  
  <pre><code> let toggle = id =&gt; {
      this.state.list.filter( val=&gt;val.id===id ? val.hidden=!val.hidden )
   }
  </code></pre>