title: How can I get the current map center coordinates using getCenter in @react-google-maps/api?
body: <p>I am working with <code>GoogleMap</code> component from <code>@react-google-maps/api</code>, but can't seem to find how can I get the currently centered map coordinates (lat &amp; lng) after I have moved it?</p>
  <p>By searching around I found <a href="https://stackoverflow.com/questions/43513518/how-call-function-getcenter-and-others-in-react-google-maps">this</a> article, which asks a similar question, but none of the answers work for me. Below is a code I'm testing.</p>
  <pre><code>import { GoogleMap, useLoadScript } from &quot;@react-google-maps/api&quot;;
  
  const { isLoaded, loadError } = useLoadScript({
      googleMapsApiKey: process.env.REACT_APP_GOOGLE_MAPS_API_KEY,
  });
  
  export default function Test() {
      return (
          &lt;&gt;
              &lt;GoogleMap
                  zoom={8}
                  center={{lat: 35.6676095, lng: 139.334863}}
                  // onCenterChanged={getCenter} - doesn't work
                  // onCenterChanged={getCenter()} - doesn't work
                  // onCenterChanged={this.getCenter} - doesn't work
                  // onCenterChanged={ (e)=&gt; this.getCenter(e)}  - doesn't work
              &gt;
              &lt;/GoogleMap&gt;
          &lt;/&gt;
      );
  }
  </code></pre>
  <p>The map loads fine, but once I add the <code>onCenterChanged=</code> prop, everything breaks because the <code>getCenter</code> function is obviously not declared.</p>
  <p>I'd like to get a variable or state with the center coordinates after I have moved the map. Where do I declare it and how do I use it?</p>