Hi, I want to update latitude and longitude as browser detects geolocation change.
So I just followed what document says, but it doesn't seem to work.
It always returns the same latitude and longitude about where I called usePosition() for the very first time.
I can't figure out what the problem is.
Below is my code:
const watch = true;
const [currPosition, setCurrPosition] = useState({
lat: 0,
long: 0,
})
const { latitude, longitude, timestamp, accuracy, error } = usePosition(
watch,
{ enableHighAccuracy: true }
);
useEffect(() => {
setCurrPosition({lat: latitude, long: longitude})
}, [latitude, longitude]);