Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 713 Bytes

useDistanceMatrixService.md

File metadata and controls

28 lines (19 loc) · 713 Bytes

useDistanceMatrixService Hook

React hook to use the Google Maps Distance Matrix Service in any component.

Usage

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 (...);
};

Return value

Returns a Distance Matrix Service instance to use directly.

google.maps.DistanceMatrixService