frontend-opensource-project / use-react-hooks

React hoooooooks๐Ÿ˜Ž
https://frontend-opensource-project.github.io/use-react-hooks/
5 stars 0 forks source link

[URH-48] useGeolocation ์‹ ๊ทœ #45

Closed Choozii closed 2 months ago

Choozii commented 3 months ago

๐Ÿ‘พ Pull Request

1๏ธโƒฃ Spec

2๏ธโƒฃ ๋ณ€๊ฒฝ ์‚ฌํ•ญ

3๏ธโƒฃ ์˜ˆ์‹œ ์ฝ”๋“œ

const { coords, timestamp, error, loading } = useGeolocation();

  if(loading){
  return <p>loading...</p>
  }

  if(error){
  return <p>{error.message}</p>
  }

  return (
    <div>
          <p>Latitude: {coords.latitude}</p>
          <p>Longitude: {coords.longitude}</p>
          <p>Altitude: {coords.altitude}</p>
          <p>Timestamp: {new Date(timestamp).toLocaleString()}</p>
    </div>
  );

4๏ธโƒฃ ๊ด€๋ จ ๋ฌธ์„œ (์„ ํƒ ์‚ฌํ•ญ)