Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
Obteniendo el error React Runtime: el tipo de elemento no es válido: se esperaba una cadena (para componentes integrados) o una clase/función (para componentes compuestos)

Así es como se ve mi código:

 import { React, useState, useEffect } from 'react'; import { GoogleMapReact } from 'google-map-react'; import styles from './Location.module.scss'; import pinstyles from './TheMap.module.scss'; import { useIntl } from 'react-intl'; /* This file has the actual with the coordinates passed to it */ const TheMap = (props) => { // for holding the API key and language const bootstrapURLKeys = { //should this be french? key: process.env.NEXT_PUBLIC_API_KEY, language: 'en', }; //const [test, setTest] = useState(false); // const marker = new google.maps.Marker({ // position: props.center, // map, // }); // To do with the language of the map const { formatMessage: f } = useIntl(); return ( <div className={styles.main}> <div className={styles.heading}> {f({ id: 'location' })} </div> <div className={styles.mapContainer}> {/* TODO: The defaultZoom should be working but it isn't, not a big deal but fix when there's time (it'll look better) */} <GoogleMapReact bootstrapURLKeys={bootstrapURLKeys} defaultZoom={props.zoom} center={props.center} yesIWantToUseGoogleMapApiInternals options={{ fullscreenControl: false }} > <Marker lat={props.lat} lng={props.lng} /> </GoogleMapReact> </div> {/* Adding the address to the bottom of the map */} {props.location[1].address} {props.location[1].postalCode} </div> ); }; const Marker = (props) => { return ( <> <div className={pinstyles.pin}></div> <div className={pinstyles.pulse}></div> </> ); }; export default TheMap;

Y este es el error completo:

Error de tiempo de ejecución no controlado

Error: el tipo de elemento no es válido: esperaba una cadena (para componentes integrados) o una clase/función (para componentes compuestos) pero obtuvo: indefinido. Probablemente olvidó exportar su componente desde el archivo en el que está definido, o puede haber mezclado las importaciones predeterminadas y con nombre.

Me gustaría saber cómo deshacerse de este error.

EDITAR: Así es como se ve mi pila de llamadas:

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tu importación GoogleMapReact es incorrecta. Debería ser:

 import GoogleMapReact from 'google-map-react';

https://github.com/google-map-react/google-map-react#getting-started

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!