Jul 4 (edited) in Help
Hook issue
When i console.log(data) it will show me all the weather information I expect.
When I use a setWeatherData(data) and console.log(weatherData) I get back undefinded.
Can someone explain why?
This only happens on the first time. After that it is fine. Am I using useEffect incorrectly? This doesn't make sense to me because if I was why would data show information but not weatherData?
Any help would be greatly appreciated.
Picture for context.
To test yourself. Just add any city and then click on it in the menu.
1
6 comments
Bret Miller
5
Hook issue
Developer Pro
skool.com/developerpro
Learn how to code. Make money. Have fun. Enjoy life.
Leaderboard (30-day)
powered by