Created
March 13, 2023 15:29
-
-
Save matiasfha/610c036c5fcdbc5726adc922cd56a6fd 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
function App() { | |
function [currentWeather, setCurrentWeather] = useState() // No hay estado al principio | |
React.useEffect(() => { | |
api.local_current("AR") | |
.then(data => setCurrentWeather(data)) | |
.catch(error => { | |
console.error(error) | |
}) | |
}, []) // El efecto se ejecuta una sola vez | |
return ( | |
<> | |
{data} | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment