React hook to use the Google Maps Distance Matrix Service in any component.
import React from 'react';
import {useDistanceMatrixService} from '@ubilabs/google-maps-react-hooks';
const MyComponent = () => {
const service = useDistanceMatrixService();
service.getDistanceMatrix(request, response => {
// Do something with the response
}
return (...);
};
Returns a Distance Matrix Service
instance to use directly.
google.maps.DistanceMatrixService