Created
May 23, 2020 16:33
-
-
Save baltazarparra/6c422b14ea59df6ea69c7744b408137b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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