title: how to use containsLocation in react-google-maps/api library
body: <p>I use the <code>react-google-maps/api</code> for maps in React. I have a polygon on my map and I want to check on each click event if the click happened inside or outside the polygon.</p>
  <pre><code>import React from &quot;react&quot;;
  import { LoadScript, GoogleMap, Polygon } from &quot;@react-google-maps/api&quot;;
  
  export default function App() {
    const paths = [
          { lat: 52.52549080781086, lng: 13.398118538856465 },
          { lat: 52.48578559055679, lng: 13.36653284549709 },
          { lat: 52.48871246221608, lng: 13.44618372440334 },
          { lat: 52.52549080781086, lng: 13.398118538856465 }
    ];
    const handleClick = (event) =&gt; {
          console.log(event.latLng);
    };
    return (
          &lt;div className=&quot;App&quot;&gt;
            &lt;LoadScript
                id=&quot;script-loader&quot;
                googleMapsApiKey=&quot;MY_API_KEY&quot;
                language=&quot;en&quot;
                region=&quot;us&quot;
            &gt;
              &lt;GoogleMap
                mapContainerClassName=&quot;App-map&quot;
                center={{ lat: 52.52047739093263, lng: 13.36653284549709 }}
                zoom={12}
                version=&quot;weekly&quot;
                on
                onClick={onClick}
              &gt;
                  &lt;Polygon
                     paths={paths}
                     strokeColor={&quot;#FF0000&quot;}
                     strokeOpacity={0.8}
                     strokeWeight={2}
                     fillColor={&quot;#FF0000&quot;}
                     fillOpacity={0.35}
                     draggable={true}
                   /&gt;
              &lt;/GoogleMap&gt;
            &lt;/LoadScript&gt;
          &lt;/div&gt;
        );
      } 
  </code></pre>
  <p>Based on the <a href="https://developers.google.com/maps/documentation/javascript/examples/poly-containsLocation#maps_poly_containsLocation-javascript" rel="nofollow noreferrer">docs</a>  there is a function <code>google.maps.geometry.poly.containsLocation(e.latLng, bermudaTriangle)</code> that I can use, so in my case in the handleClick function it would look similar to this:
  <code>containsLocation(event.latLng, paths)</code>.</p>
  <p>However, I don't know how to call this function, <code>@react-google-maps/api</code> doesn't export <code>geometry</code> or <code>poly</code>. <a href="https://react-google-maps-api-docs.netlify.app/#polyline" rel="nofollow noreferrer">Here</a> is the doc.</p>
  <p>How do I use this function?</p>