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

161
Views
¿Cómo accedo al valor dentro del cuadro de texto de entrada? ¿No puedo obtener el valor directamente de la variable de evento sin usar ref?

Estoy tratando de acceder al valor dentro del cuadro de texto y guardarlo en la variable de estado. ¿Puedo acceder a él sin usar "ref". También la declaración:

 console.log(this.input.value)

Imprime la entrada correcta en la consola. Pero si lo hago a continuación:

 ref ={(input)=>{ this.input = input console.log(input.value) }}

me sale un error Por favor, ayúdame a entender qué está pasando en el código completo a continuación.

 <input type="text" className = "form-control form-control-lg" placeholder ='0' onChange = {async (event)=>{ const tokenValue = await this.input.value.toString() * 100 console.log(this.input.value) this.setState ({ output:tokenValue }) console.log(this.state.output) }} ref ={(input)=>{this.input = input}} required/>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede obtener el valor de entrada fácilmente como siguiendo

 export default function App() { const [value, setValue] = useState(); const handleInputChange = (e) => { setValue(e.target.value); }; return ( <> <form> <input type="text" value={value} onChange={(e) => handleInputChange(e)} /> </form> </> ); }
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!