showing results for - "how to detect if app is loosing focuse in react native"
Hana
05 Jul 2017
1Copyimport { useFocusEffect } from '@react-navigation/native';
2function Profile({ userId }) {  const [user, setUser] = React.useState(null);
3  useFocusEffect(    React.useCallback(() => {      const unsubscribe = API.subscribe(userId, user => setUser(data));
4      return () => unsubscribe();    }, [userId])  );
5  return <ProfileContent user={user} />;}