can someone explain to me how can I return a value from another component?
I tried the following:
const ReturnText = () => {
  return 'Returend text'
}
    
export default ReturnText;
And i try to call it in Foo like this
import ReturnText from '../ReturnText'
    
let someText;
const Foo = (props) => {
  someText = ReturnText()
  console.log(someText) // is shown as undefined in the debugger
}
But  when I try to log the someText variable I get undifend.
EDIT:
It seems the code above works. but maybe I oversimplified my issue:
Here is my actual code (that I thought is identical)
import Geolocation from "react-native-geolocation-service";
    
let hasLocationPermission = true;
    
const LocateMe = () => {
  if (hasLocationPermission) {
    Geolocation.getCurrentPosition(
      (position) => {
        console.log(position);
        return position;
      },
      (error) => {
        // See error code charts below.
        console.log(error.code, error.message);
      },
      { enableHighAccuracy: true, timeout: 15000, maximumAge: 10000 }
    );
  }
}
    
export default LocateMe;
I try to call the LocateMe in Foo and assign the returned position to a variable (ant that variable gives me undefined)
 
     
     
    