I am creating a React app that uses Fetch to pull a API using SQLite, however for some reason it shows in console length: 3, and Array[0] only. I cannot pull from data just id 1 for example.
import React, { useState, useEffect } from "react";
export default () => {
const [brands, setBrands] = useState(null);
useEffect(() => {
fetch("/api/brands")
.then((response) => response.json())
.then((data) => console.log(data))
.then((data) => {
setBrands(data);
});
}, []);
return (
<>
{brands ? (
<>
<h1>Brands</h1>
<ul>
{brands.map((brand) => (
<li key={brand.id}>{brand.name}</li>
))}
</ul>
</>
) : (
<div>Loading...</div>
)}
</>
);
};
How would I be able to pull from this id 1 for example? at the moment only all the brands show when I remove the console log and show as I pasted in the screen shot above in console.

console.log(brands.find(brand => brand.id === 1));<ul> {brands.map((brand) => ( <li key={brand.id}>{brand.name}</li> ))} </ul>to show only brand name with id of 1.