Hej. Mam problem. Udało mi się wyświetlić wszystkie obiekty ze stworzonego API ale nie mam pojęcia jak wyświetlić tylko i wyłącznie np pierwszy lub drugi obiekt. Ktoś się orientuje? Pozdrawiam
import React from "react";
import "./styles.css";
const Employee = ({ data }) => {
const { name, surname } = data;
return <div>{`Witaj: ${name} ${surname}`}</div>;
};
export default function App() {
const [state, setState] = React.useState([]);
const url = "https://60226fc4ae8f8700177df76f.mockapi.io/api/v1/users";
fetch(url)
.then((response) => response.json())
.then((data) => setState(data));
console.log(state);
return (
<div>
<div>
{state.map((data) => {
return <Employee data={data} />;
})}
</div>
</div>
);
}