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.