Skip to content

Commit 5a7efc7

Browse files
committed
feat(README): add useElevationService hook to readme
1 parent 2c2fe2c commit 5a7efc7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,39 @@ Returns the [`PlacesService`](google.maps.places.PlacesService) class to use dir
479479
google.maps.places.PlacesService
480480
```
481481

482+
### useElevationService
483+
484+
React hook to use the [Elevation Service](https://developers.google.com/maps/documentation/javascript/elevation) in any component.
485+
486+
#### Usage
487+
488+
```jsx
489+
import React from 'react';
490+
import {useElevationService} from '@ubilabs/google-maps-react-hooks';
491+
492+
const MyComponent = () => {
493+
const elevator = useElevationService();
494+
495+
elevator?.getElevationForLocations(
496+
{locations: [location]},
497+
(results: google.maps.ElevationResult[]) => {
498+
// Do something with results
499+
}
500+
);
501+
502+
return (...);
503+
};
504+
```
505+
506+
#### Return value
507+
508+
Returns the [`ElevationService`](google.maps.places.ElevationService) class to use directly.
509+
510+
```TypeScript
511+
google.maps.places.ElevationService
512+
```
513+
514+
482515
## Publish (only for maintainers)
483516
484517
`npm publish --access public`

0 commit comments

Comments
 (0)