Skip to content

Commit 2d76869

Browse files
authored
Merge pull request #66 from ubilabs/feat/add-distance-matrix-readme
feat(readme): add distance matrix
2 parents be9d081 + 3b7751f commit 2d76869

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This is a JavaScript library to easily implement a Google Maps map into your Rea
1616
- [useDirections](#usedirections)
1717
- [useGeocoder](#usegeocoder)
1818
- [usePlacesService](#useplacesservice)
19+
- [useDistanceMatrix](#usedistancematrix)
1920
- [Publish](#publish)
2021

2122
## Requirements
@@ -479,6 +480,35 @@ Returns the [`PlacesService`](google.maps.places.PlacesService) class to use dir
479480
google.maps.places.PlacesService
480481
```
481482

483+
### useDistanceMatrix
484+
485+
React hook to use the [Google Maps Distance Matrix Service](https://developers.google.com/maps/documentation/javascript/distancematrix) in any component.
486+
487+
#### Usage
488+
489+
```jsx
490+
import React from 'react';
491+
import { useDistanceMatrix } from '@ubilabs/google-maps-react-hooks';
492+
493+
const MyComponent = () => {
494+
const service = useDistanceMatrix();
495+
496+
service.getDistanceMatrix(request, response => {
497+
// Do something with the response
498+
}
499+
500+
return (...);
501+
};
502+
```
503+
504+
#### Return value
505+
506+
Returns the [`DistanceMatrixService`](google.maps.DistanceMatrixService) class to use directly.
507+
508+
```TypeScript
509+
google.maps.DistanceMatrixService
510+
```
511+
482512
## Publish (only for maintainers)
483513
484514
`npm publish --access public`

0 commit comments

Comments
 (0)