title: How to extract value of a property of array of objects?
body: <p>I have this data (data1) below, an array of objects with multiple objects inside:</p>
  <pre><code>[
      {
          &quot;id&quot;: 35,
          &quot;code&quot;: &quot;BP  S&quot;,
          &quot;article&quot;: &quot;BP  S&quot;,
          &quot;price&quot;: 100,
          &quot;vat&quot;: null,
          &quot;status&quot;: null,
          &quot;company_id&quot;: 12
      },
      {
          &quot;id&quot;: 36,
          &quot;code&quot;: &quot;B P  S&quot;,
          &quot;article&quot;: &quot;BPS&quot;,
          &quot;price&quot;: 100,
          &quot;vat&quot;: null,
          &quot;status&quot;: null,
          &quot;company_id&quot;: 12
      }
  ]
  </code></pre>
  <p>I would like to extract the <code>code</code> of the first <code>id</code>=35.</p>
  <p><strong>How to do that?</strong></p>
  <p>My code:</p>
  <pre><code>import { useLocation } from &quot;react-router-dom&quot;;
  
  const Single = ({ inputs, title }) =&gt; {
    const { state } = useLocation();
    let data1 = state.foo;
    console.log(data1);
  </code></pre>