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