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

123
Views
No se puede ingresar en el cuadro de texto o hacer clic en el botón en reaccionar

Ya no puedo hacer clic en mi cuadro de texto o botón de entrada por alguna razón. Se rompió mientras estaba diseñando los elementos. Cuando cargo la página por primera vez, el atributo de enfoque automático aún funciona, pero tan pronto como intento hacer clic en el botón o volver a ingresar el cuadro de texto, no funciona.

 import React, { useState } from 'react'; import axios from 'axios'; function Header() { const [text, setText] = useState(""); function handleChange(event) { setText(event.target.value); } function handleClick() { const geoCoderURL = "http://api.openweathermap.org/geo/1.0/direct?q=" + text + "&limit=5&appid=feab629ddad64dc21d6412ebae467d79" function getCoordinates(url) { axios.get(url).then((response) => { const locationLat = response.data[0].lat; const locationLon = response.data[0].lon; console.log(locationLat, locationLon); }); } getCoordinates(geoCoderURL); } return ( <div className="header"> <h1 className="headerTitle">Five Day Forecast</h1> <input onChange={handleChange} type="text" name="name" autoFocus placeholder="Enter city name here."/> <button type="submit" onClick={handleClick}>Forecast</button> </div> ) } export default Header;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Mira esto. Aquí está el enlace de Sandbox

 import React, { useState } from "react"; import axios from "axios"; function Header() { const [text, setText] = useState(""); const [locationLat, setlocationLat] = useState(""); const [locationLon, setlocationLon] = useState(""); function handleClick() { console.log(text); axios.get( `https://api.openweathermap.org/geo/1.0/direct?q=${text}&limit=5&appid=feab629ddad64dc21d6412ebae467d79` ) .then(function (response) { setlocationLat(response.data[0].lat); setlocationLon(response.data[0].lon); }) .catch(function (error) { console.log(error); }); } function handleInput(e) { setText(e.target.value); } return ( <div className="header"> <h1 className="headerTitle">Five Day Forecast</h1> <input onChange={handleInput} type="text" name="name" autoFocus placeholder="Enter city name here." /> <button onClick={handleClick}>Forecast</button> <p>{locationLat}</p> <p>{locationLon}</p> </div> ); } export default Header;

ingrese la descripción de la imagen aquí

Revocar la clave de API o ID de la aplicación, no publicarla públicamente

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!