TypeError: Cannot read properties of undefined (reading 'maps')

690 views Asked by At

I am trying to use the DistanceMatrixService from @react-google-maps/api. One of the required parameters is the 'travelMode'. However, when I tried setting 'travelMode' to 'DRIVING', it shows the following!

enter image description here

I tried doing travelMode: google.maps.TravelMode.DRIVING but it also throws a type error

TypeError: Cannot read properties of undefined (reading 'maps')

enter image description here

Here is a snippet of my code where I call the Distance Matrix Service.

snippet

0

There are 0 answers