How do I place this object inside an array: Dog API. Is an object inside another object. I'm trying to set setBreeds(breedsList.message) but does not work.
const basicUrl = `https://dog.ceo/api/breeds/`
const listUrl = `list/all`
const Home = () => {
// uses state to store the list of breeds
const [breeds, setBreeds] = useState([])
// fetch the list of breeds
const fetchBreeds = async () => {
let url
url = `${basicUrl}${listUrl}`
const response = await fetch(url)
const breedsList = await response.json()
setBreeds(breedsList)
}
// useeffect to mount the fetchBreeds function
useEffect(() => {
fetchBreeds()
}, [])
return (
<div>
{/* // maps */}
{breeds.map((breed) => console.log(breed))}
</div>
)
}
export default Home