I want to loop between the data from this api,but i can't show them in return(doesn't show something)
const Api_Endpoint = 'https://api.punkapi.com/v2/beers'
const [beers, setBeers] = useState([])
const [description, setDescription] = useState([])
const [img, setImg] = useState([])
useEffect(() => {
fetch(Api_Endpoint)
.then(results => results.json())
.then(data => {
setBeers(data[0].name)
setDescription(data[0].description)
setImg(data[0].image_url)
})
}, [])
i did it with one useState before,but how can i do that for multiple useState?
I write it like this:
return (
<div>
{value => {
return value.beers.map(product => {
return <Beer key={product.id} product={product.name} />;
});
}}
</div>
);