Answer the question
In order to leave comments, you need to log in
How to get data from API and insert into React component?
I send a request to the API, the response is an object with data:
Object
main:
temp:200
id:2207456
const TopComponent = ()=>{
useEffect(() => {
fetch("api.openweathermap.org/data/2.5/weather?q=Perm&lan...")
.then(res => res.json())
.then( data => console.log(data)
)
})
Return(
<div> $ </div>
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question