@@ -8,39 +8,39 @@ export default function Page() {
88 useEffect ( ( ) => {
99 const watchID = navigator . geolocation . watchPosition (
1010 ( position ) => {
11- setPositions ( [ position , ...positions ] ) ;
12- setUpdateCount ( updateCount + 1 ) ;
11+ setPositions ( ( ) => [ position , ...positions ] ) ;
12+ setUpdateCount ( ( ) => updateCount + 1 ) ;
1313 } ,
1414 ( ) => { } ,
1515 { enableHighAccuracy : true }
1616 ) ;
1717
1818 return ( ) => {
1919 navigator . geolocation . clearWatch ( watchID ) ;
20- }
21- } , [ setPositions ] ) ;
20+ } ;
21+ } , [ setPositions , setUpdateCount ] ) ;
2222
2323 return ( < div >
2424 < div > { updateCount } </ div >
2525 { positions . map ( ( pos , index ) => {
26- const coords = pos . coords
26+ const coords = pos . coords ;
2727 const coordEntries : [ keyof GeolocationCoordinates , number | null ] [ ] = [
28- [ ' latitude' , coords . latitude ] ,
29- [ ' longitude' , coords . longitude ] ,
30- [ ' altitude' , coords . altitude ] ,
31- [ ' accuracy' , coords . accuracy ] ,
32- [ ' altitudeAccuracy' , coords . altitudeAccuracy ] ,
33- [ ' heading' , coords . heading ] ,
34- [ ' speed' , coords . speed ] ,
28+ [ " latitude" , coords . latitude ] ,
29+ [ " longitude" , coords . longitude ] ,
30+ [ " altitude" , coords . altitude ] ,
31+ [ " accuracy" , coords . accuracy ] ,
32+ [ " altitudeAccuracy" , coords . altitudeAccuracy ] ,
33+ [ " heading" , coords . heading ] ,
34+ [ " speed" , coords . speed ] ,
3535 ] ;
3636
37- return < div style = { { border : "1px solid white" , padding : "10px" } } key = { index } >
37+ return < div style = { { border : "1px solid white" , padding : "10px" } } key = { index } >
3838 { coordEntries . map ( ( [ key , value ] ) => (
3939 < div key = { key } >
40- < strong > { key } :</ strong > { value === null ? ' N/A' : value }
40+ < strong > { key } :</ strong > { value === null ? " N/A" : value }
4141 </ div >
4242 ) ) }
43- </ div >
43+ </ div > ;
4444 } ) }
4545 </ div > ) ;
4646}
0 commit comments