Skip to content

Instantly share code, notes, and snippets.

@baltazarparra
Created May 23, 2020 16:33
Show Gist options
  • Save baltazarparra/6c422b14ea59df6ea69c7744b408137b to your computer and use it in GitHub Desktop.
Save baltazarparra/6c422b14ea59df6ea69c7744b408137b to your computer and use it in GitHub Desktop.
import React, { useState, useEffect } from 'react'
import axios from 'axios'
function Test() {
const [breeds, setBreeds] = useState({})
useEffect(() => {
axios.get('https://dog.ceo/api/breeds/list/all')
.then(res => {
setBreeds(res.data.message)
})
}, [])
const lista = Object.entries(breeds)
return (
<ul>
{lista.map(
item => {
return <p>{`Raça: ${item}`}</p>
}
)}
</ul>
)
}
export default Test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment