Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

170
Vistas
React Native Button onPress function example

What is the difference between using the two and when should I use one over the other

<Button onPress={this.refreshData}>
<Button onPress={()=>this.refreshData()}>
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Here is an extract from React Docs.

You can use an arrow function to wrap around an event handler and pass parameters:

<button onClick={() => this.handleClick(id)} />

This is equivalent to calling .bind:

<button onClick={this.handleClick.bind(this, id)} />

https://reactjs.org/docs/faq-functions.html

about 4 years ago · Juan Pablo Isaza Denunciar

0

You should do this if you don't need to pass an argument to your function :

<Button onPress={this.refreshData}>

Doing this <Button onPress={()=>this.refreshData()}> may break optimizations.
From React doc:

Using an arrow function in render creates a new function each time the component renders, which may break optimizations based on strict identity comparison.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda