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

162
Views
Lat y Long se muestran no definidos cuando se usan literales de plantilla

Uso de la API de Accuweather para crear una aplicación meteorológica. Creo que me he equivocado en alguna parte con la sintaxis, pero no puedo entender dónde me equivoqué. ¿Algún consejo?

Línea 26:100: 'lat' no está definido no-undef

Línea 26:109: 'largo' no está definido sin definición

 import { useEffect, useState } from "react"; function Location() { let [data, setData] = useState([]); const key = process.env.REACT_APP_API_KEY; useEffect(() => { if (!data) return; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(successFunction, console.log()); } else { alert( "It seems like Geolocation, which is required for this page, is not enabled in your browser. Please use a browser that supports it." ); } function successFunction(latlong) { const lat = latlong.coords.latitude; const long = latlong.coords.longitude; console.log("latlong = " + lat + ", " + long); } fetch( `http://dataservice.accuweather.com/locations/v1/cities/geoposition/search?apikey=${key}&q=${lat}%2C${long}` ) .then((response) => response.json()) .then((data) => setData(data)) .catch((err) => console.log(`Error Meassage ${err}`)); }, []); console.log("location key = ", data.Key); } export default Location;
about 4 years ago · Santiago Trujillo
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!