get location from brwoser react 1

get location from brwoser react

npm install react-geolocated --save

Here is what the above code is Doing:
1. We’re importing the Geolocated component from the react-geolocated library.
2. We’re creating a new class called App.
3. We’re rendering the Geolocated component.
4. We’re passing a render prop to the Geolocated component.
5. We’re rendering a div with the user’s coordinates if the user is geolocated.
6. We’re rendering a div with a message if the user is not geolocated.

Similar Posts