0

I have a React component that thrwos a strange error in the '@react-google-maps/api' Autocomplete file.

import {useState, useRef} from 'react'

// Google Maps Imports
import { useJsApiLoader, Autocomplete } from '@react-google-maps/api'
import { geocodeByAddress, getLatLng } from 'react-google-places-autocomplete'

type libs = ("places" | "drawing" | "geometry" | "localContext" | "visualization")[]

const FahrtToLatLng = () => {
  const [ libraries ] = useState<libs>(['places']);
  const locationRef = useRef<HTMLInputElement>(null);


  return (
    <div>
      <form>
        <Autocomplete>
          <input type="text"></input>
        </Autocomplete>
        <button onClick={(e) => {
          e.preventDefault()
          console.log(locationRef.current?.value)
          }}>GIMME THAT SWEET DATA</button>
      </form>
    </div>
  )
}

export default FahrtToLatLng

thats my Component if I try to run it ill get this strange error.

const google = window.google; wont fix the issue as many online answers suggested.

enter image description here

Luke_KS
  • 123
  • 2
  • 11

0 Answers0