import { useEffect, useState } from "react"; import Td from "./Td"; const FarmList = () => { const [data, setData] = useState([]); useEffect(() => { fetch("http://localhost:8000/api/v1/farm", { credentials: "include", method: "GET", headers: { "Content-Type": "application/json" }, }) .then((response) => response.json()) .then((data) => setData(data)) .catch((error) => console.error(error)); }, []); return (
{data.length > 0 ? ( data.map((item) => )}
Farm name Location Type Size (acres) Action
) ) : (
No data available
); }; export default FarmList;