title: my find function isn't working on my array of objects when trying to compare against my params
body: <p>Im building a litigation manager app using RoR as my backend API and React as my frontend. I have a Lawyer component that is supposed to be a profile page of an individual lawyer (object). I used react routes to route the url for the individual object based on the lawyer id maintained in the object.</p>
  <pre><code>import React from 'react'
  import { useParams } from 'react-router-dom'
  
  const Lawyer = ( {lawyersArray} ) =&gt; {
    let params = useParams();
    
  function getLawyerId() {
      lawyersArray.find(
        (lawyer) =&gt; lawyer.id === params.id
      )
  }
  
  let lawyerProfile = getLawyerId(parseInt(params.id));
  
    return (
      &lt;div&gt;
       {console.log(lawyerProfile)}
      &lt;/div&gt;
    )
  }
  
  export default Lawyer
  </code></pre>
  <p>However, my lawyerProfile return variable always returns undefined. If I add a console log into my find function, I can see that I have values for params.id and lawyer.id so I am not sure why it says undefined.</p>
  <pre><code>function getLawyerId() {
  lawyersArray.find(
    (lawyer) =&gt; console.log(lawyer.id)
    )
  }
  </code></pre>
  <p>This logs out all the lawyer ids in the console.</p>
  <pre><code> function getLawyerId() {
      lawyersArray.find(
        (lawyer) =&gt; console.log(lawyer.id)
        )
      }
  </code></pre>
  <p>While this logs out the one params.id that matches the url params. So they do exist but they cant seem to find each other when I use the === operation to return the desired id. I feel like there is a JS fundamental i am missing. In both instances, the return value is an integer of the id.</p>
  <p>Here is my backend data.</p>
  <pre><code>[
   {
    id: 1,
    first_name: &quot;Howard&quot;,
    last_name: &quot;Zelbo&quot;,
   },
   {
    id: 2,
    first_name: &quot;Christopher&quot;,
    last_name: &quot;Moore&quot;,
   },
   {
    id: 3,
    first_name: &quot;Jon&quot;,
    last_name: &quot;Blackman&quot;,
   }
  ]
  </code></pre>