Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

247
Vistas
google-maps-react change lat and lng value won't update the map

Current I faced a problem with google-maps-react, When I change the value of lat and lng. The location of the map won't change to the location selected using a select box.

...
  const [selectedCountry, setSelectedCountry] = useState({});
  const handleChangeCountry = (event, index) => {
    setLoading('true');
    setSelectedIndex(index);
    setCountryValue(countryList[index]);
  };
 const setCountryValue = (value) => {
    let updatedValue = {};
    updatedValue = value;
    setSelectedCountry(selectedCountry => ({
      ...selectedCountry,
      ...updatedValue
    }))
    setLoading('false');
  };

<Map
              google={window.google}
              zoom={10}
              style={mapStyles}
              initialCenter={
                {
                  lat: selectedCountry.latlng[0],
                  lng: selectedCountry.latlng[1]
                }
              }
            ><Marker 
            name={'Current location'} />
            </Map>

Below I have provided some screenshot.

enter image description here

enter image description here

As you can see the value change in the right details section, but the map at the middle still remains the same as the 1st picture.

Thanks for taking your time to help me/

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda