title: How to update the state of the map
body: <p>I am trying to create a polygon on click of the map and every time I add a new LatLng Object to the array, I assign it to the Polygon object but I realize that the polygon saves older values too and does not get only the values of the newly created array. How can I rerender the polygon once I assign the newly updated array.</p>
  
  <pre><code>        function add_point(map, location) {
             upcoming_point = {lat: location.lat(), lng:location.lng() }
             poligon_array.push(upcoming_point)
  
             if(polygon_array.length&gt;5){
               polygon_array.shift();
             }
             create_Polygon(polygon_array);
           }
  
           function create_Polygon(polygon_array) {
               var Polygon = new google.maps.Polygon({
                   paths: polygon_array,
                   strokeColor: '#FF0000',
                   strokeOpacity: 0.8,
                   strokeWeight: 2,
                   fillColor: '#FF0000',
                   fillOpacity: 0.35
                 });
                Polygon.setMap(map);
  
            }
  </code></pre>