#fetch nested datas

9 messages · Page 1 of 1 (latest)

hallow bone
plain yoke
#

U did not define weatherItem in any part of ur code before u console log it.. that’s why it’s showing weatherItem is not defined error.. can u tell me more what are you trying to console log? If u want to console log the data u just fetch, u should use weatherData

hallow bone
plain yoke
hallow bone
plain yoke
# hallow bone i want to access my data i just fetched in the effect so i use the weatherData b...

i fixed ur code alil bit. I made useState({}) instead of useState([]) because the data we fetched is an object. anyway the data becomes 'weatherData'. so we can access weatherData.main.temp for the temperature as in the screenshot i attached. here is the sandbox i forked from you https://codesandbox.io/s/react-weather-app-forked-kltwo2?file=/src/App.js. Let me know if you get the answer you wanted.

REACT WEATHER APP (forked) by neew18 using loader-utils, react, react-dom, react-scripts

hallow bone
sick badge