Skip to content

Instantly share code, notes, and snippets.

@matiasfha
Created March 13, 2023 15:29
Show Gist options
  • Save matiasfha/610c036c5fcdbc5726adc922cd56a6fd to your computer and use it in GitHub Desktop.
Save matiasfha/610c036c5fcdbc5726adc922cd56a6fd to your computer and use it in GitHub Desktop.
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