title: select a single item from json array in reactjs
body: <p>I'm having following json file,</p>
  <pre><code>[
      {
          &quot;id&quot; : 7,
          &quot;intro&quot;: &quot;intro_7&quot;
         
      },
      {
          &quot;id&quot; : 8,
          &quot;intro&quot;: &quot;intro_8&quot;
      }
  ]
  </code></pre>
  <p>Then I'm trying to filter one of object from above json file, Thats I'm trying to this following way.</p>
  <pre><code>import React,{ useState, useEffect} from 'react';
  import source_data from '../source/data.json';
  
  function CardIntro(props){
  
      let {selectedItem} = source_data.find(item =&gt; item.id == 8);
  
      return(
  
              &lt;div&gt; Card Intro  &lt;/div&gt;
              &lt;div&gt;{selectedItem.intro}&lt;/div&gt;
  
      )
  }
  
  export default CardIntro;
  </code></pre>
  <p>I'm getting the following error, what is missing here</p>
  <blockquote>
  <p>TypeError: Cannot read property 'intro' of undefined</p>
  </blockquote>
  <p>I tried to use <strong>.filter</strong> also not successful</p>