Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
react-google-maps not showing and probably not able to request into the api

I really need some help about this. My react project is not working with react google maps that well. I tried my other projects that has it and still works but now I am creating a new one it does not work. Whenever I look at the google console, the requests are not adding up and my react project is still blank. I have also already setted in css the div's width to height: 100vh and width: 100%

Component Code

import React, { useState, useEffect } from 'react'
import '../css/Home.css';
import { GoogleMap, withScriptjs, withGoogleMap, Marker, InfoWindow } from 'react-google-maps'
import Axios from 'axios';

function Map(){

  const [coords, setcoords] = useState({ lat: "", lng: "" });

  // navigator.geolocation.watchPosition((position) => {
  //   console.log(position);
  // })

  return(
      <GoogleMap 
        defaultZoom={15} 
        defaultCenter={{ lat: 14.706010, lng: 121.086983 }}
      >
      </GoogleMap>
  )
}

const WrappedMap = withScriptjs(withGoogleMap(Map));

function Home() {
  return (
    <div id='div_home'>
      <WrappedMap 
        googleMapURL={`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=MY_KEY_I_JUST_REMOVED_IT`}
        loadingElement={<div style={{height: '100%'}} />}
        containerElement={<div style={{height: '100%'}} />}
        mapElement={<div style={{height: '100%'}} />}
         />
    </div>
  )
}

export default Home

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I have solved my issue. Turns out that I have a react and react-dom v.18 something and I installed the 17.0.2 version and it totally worked! Just having troubles with the version.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda