title: ReactJS: Map and Find
body: <p>Introduction</p>
  <p>I have a search filter in which I enter parameters such as sender and recipient.</p>
  <p>In this way for the sender I make a call and get results.
  For the recipient I make another call and get other results.</p>
  <p>So I will have two arrays:</p>
  <blockquote>
  <p>sent</p>
  </blockquote>
  <blockquote>
  <p>sent1</p>
  </blockquote>
  <p>what I would like to do is iterate through the first arrival comparing each element with each element of the second array and if a certain condition is exceeded save the element of the first array.</p>
  <p>Now my Code is:</p>
  <pre><code>let filteredSent = {rows: []}
  sent.rows.map( (elem) =&gt; { sent1.rows.find( (value) =&gt; { 
            if(value.key[2] === values.recipient.Code &amp;&amp; value.key[0] === &quot;RECIPIENT&quot; &amp;&amp; elem.key[1] === value.key[1] &amp;&amp; elem.key[3] === value.key[3] &amp;&amp; elem.value === value.value){
              filteredSent.rows.push(elem)
            }
        })
      } )
  </code></pre>
  <p>where <code>values.recipient.Code</code> is an input value that I choose from a list.
  My problem is that I make this comparison, but I find myself certain results that shouldn't be there.</p>
  <p>Is what I'm doing the map and find a wrong use?</p>
  <p>Thank you all for your time.</p>