IDNLearn.com: Where your questions meet expert advice and community support. Ask your questions and receive comprehensive and trustworthy answers from our experienced community of professionals.

Why is my use effect not working react native.

Sagot :

The reason this happens is because the api call is asynchronus, it doesn't populate the state immediately, so the render happens first and tries to read current from the initial weather state null in the render method make sure not to read weather