title: UseEffect with getPermissionAsync
body: <p>unfortunately I am struggling with the hook lifecycle in react native.
  I have two hooks at the top level.</p>
  <pre><code>const permission = useLocationPermission();
  const location = useCurrentLocation(locationPermission);
  </code></pre>
  <p>The first one handles the location permission permission and asks the user to grand.</p>
  <pre><code>export default function useLocationPermission() {
    const [hasLocationPermission, setHasLocationPermission] = useState(false);
    const appState = useRef(AppState.currentState);
  
    useEffect(() =&gt; {
      
      hasPermission();
    }, []);
  
    const hasPermission = async () =&gt; {
      const { granted } = await Location.getForegroundPermissionsAsync();
      if (!granted) {
        const { granted: request } =
          await Location.requestForegroundPermissionsAsync();
        if (!request) {
          Alert.alert(
            &quot;Some Message&quot;
          );
          setHasLocationPermission(false);
        } else {
          setHasLocationPermission(true);
        }
      } else {
        setHasLocationPermission(true);
      }
    };
    
    return hasLocationPermission;
  }
  </code></pre>
  <p>The second one handles the current location.</p>
  <pre><code>export default function useCurrentLocation(hasPermission: boolean) {
    const [currentLocation, setCurrentLocation] = useState&lt;LatLng&gt;(initLocation);
  
    useEffect(() =&gt; {
      console.log(hasPermission);
  
      if (hasPermission) {
        setWatcher();
        
        getCurrentPosition().then((locationObject) =&gt; {
          setCurrentLocation({
            latitude: locationObject.coords.latitude,
            longitude: locationObject.coords.longitude,
          });
        });
      } else {
        setCurrentLocation(initLocation);
      }
    }, []);
  
    const getCurrentPosition = async () =&gt; {
      return Location.getCurrentPositionAsync({});
    };
  
    const setWatcher = async () =&gt; {
      await Location.watchPositionAsync({ distanceInterval: 5 }, (locaction) =&gt; {
        setCurrentLocation({
          latitude: locaction.coords.latitude,
          longitude: locaction.coords.longitude,
        });
      });
    };
    return currentLocation;
  }
  </code></pre>
  <p>My problem is that after the user has granted the permission. The location will not been updated anymore (still the initial location). It seems that the second hook is only called ones.
  Is there any best practice to handle such situation. So the location will be updated and the watcher is set after the permission is set.</p>
  <p>Thanks a lot.</p>