A package for retrieving the current geolocation and address information.
- To get Current-location Of the User
- You Can Tag location with Images
- You Can Get Longitude & Latitude
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|
| Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
Using npm:
$ npm install current-location-geoHere's an example of how to use the getLocation function in a React component:
Once the package is installed, you can import the library using import or require approach:
import { getLocation } from 'current-location-geo'; getLocation(function (err, position) {
if (err) {
console.error('Error:', err);
} else {
console.log('Latitude:', position.latitude);
console.log('Longitude:', position.longitude);
console.log('Address:', position.address);
}
});Example in react js :
import React, { useEffect } from 'react';
import { getLocation } from 'current-location-geo';
export default function App() {
useEffect(() => {
getLocation(function (err, position) {
if (err) {
console.error('Error:', err);
} else {
console.log('Latitude:', position.latitude);
console.log('Longitude:', position.longitude);
console.log('Address:', position.address);
}
});
}, []);
return (
<div className="App">
<h1>Hello World</h1>
</div>
);
}




