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

227
Views
Cómo lograr "e.target.value" en reaccionar nativo

quiero acceder al valor del botón en reaccionar nativo, en javascript puro se ve así:

 const checkingStuff = (e) => console.log(e.target.value) <button onclick={checkingStuff} > this is the value </button>.

¿Cómo lograr lo mismo en reaccionar nativo?

editar: responda en reaccionar nativo, no reaccionar js, porque

 <Button onPress={checkingStuff} title='lalala123'/>

dame 'indefinido'.

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

0

event handlers le brindan acceso inherente al event a través de la función. A menos que se establezca específicamente el estado dentro del DOM, no es necesario realizar una función de flecha en línea. Simplemente puede hacer referencia a la función de esta manera:

 const checkingStuff = (e) => { console.log(e.target.value) } <button onClick={checkingStuff} > Set state and add your {value} like so </button>
about 4 years ago · Juan Pablo Isaza Report

0

No sé exactamente qué intenta lograr, sin embargo, debe acceder al evento directamente en la entrada en lugar del botón. Para TextInput en React Native, el texto modificado se pasa como un único argumento de cadena al controlador de devolución de llamada.

Puedes probar esto

 const [text, onChangeText] = useState("") const onPress = () => { console.log(text) } return ( <> <TextInput value={text} onChangeText={onChangeText}> <Button onPress={onPress}/> </> )
about 4 years ago · Juan Pablo Isaza Report

0

Puedes obtener así:

 const checkingStuff = (e) => console.log(e.target.value) <button onclick={(e) => checkingStuff(e)} > this is the value </button>
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!