0

I ma facing this issue

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

  useEffect(() => {

    firebase.auth().onAuthStateChanged((user) => {
      if (user !== null) {
        return firebase
          .firestore()
          .collection("users")
          .doc(user.uid)
          .get()
          .then((documentSnapshot) => {
            if (documentSnapshot.exists) {
              setUserData(documentSnapshot.data());
              setisloadingComplet(true);
            }
          });
      }
    });

    
  }, []);

when ever the user update his info . It does not update immediately until I refresh the app . and it throws me the warning above

houcin olmostaf
  • 191
  • 1
  • 12

1 Answers1

0

thank you guys . I solved this . the problem is that I get the data from both profile and homescreen. what I did is removed getting the data from profile screen. instead I got the user Data only from homescreen then pass it to profile screen via navigation.

houcin olmostaf
  • 191
  • 1
  • 12