Skip to content

Commit db51f8e

Browse files
committed
refactor(readme): update example usage code for max zoom hook
1 parent 3b61309 commit db51f8e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -485,19 +485,22 @@ React hook to use the [Maximum Zoom Imagery Service](https://developers.google.c
485485

486486
#### Usage
487487

488-
```jsx
489-
import React from 'react';
488+
```tsx
489+
import React, {useEffect} from 'react';
490490
import {useMaxZoomService} from '@ubilabs/google-maps-react-hooks';
491491

492492
const MyComponent = () => {
493493
const maxZoomService = useMaxZoomService();
494-
495-
maxZoomService.getMaxZoomAtLatLng(
496-
LatLng,
497-
(result: google.maps.MaxZoomResult) => {
498-
// Do something with result
499-
}
500-
);
494+
const location = /** google.maps.LatLng */;
495+
496+
useEffect(() => {
497+
maxZoomService?.getMaxZoomAtLatLng(
498+
location,
499+
(result: google.maps.MaxZoomResult) => {
500+
// Do something with result
501+
}
502+
);
503+
}, [location]);
501504

502505
return (...);
503506
};

0 commit comments

Comments
 (0)