Skip to content

shaneiadt/re-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS coverage

Use-Re-Hooks

Potentially "Useful React hooks"!

Usage

useGeolocation

export const App = () => {
  const error = (err: GeolocationPositionError) => {
    console.error(err);
  };

  const [location, setlocation] = useState<GeoPosition>();

  useGeolocation({ success: setlocation, error });

  return (
    <>
      <p>Longitude: {location?.coords.longitude}</p>
      <p>Latitude: {location?.coords.latitude}</p>
    </>
  );
};