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

179
Vistas
App.js:69 Uncaught TypeError: Cannot read properties of undefined (reading 'setState')

Can anyone help me, I am getting this error "App.js:69 Uncaught TypeError: Cannot read properties of undefined (reading 'setState') at onInputChange (App.js:69:1)" Code Snippet

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Few ways to go about this.

Since you're not using arrow function you need to bind your handlers

constructor() {
  ...code
  this.onInputChange = this.onInputChange.bind(this)
  this.onButtonSubmit = this.onInputChange.bind(this)
}

option 2 - switch your function to arrow function

onInputChange = (event) => {
  ...code
}

onButtonSubmit = () => {
  ...code
}

Here's a helpful post to help you understand why

https://www.freecodecamp.org/news/this-is-why-we-need-to-bind-event-handlers-in-class-components-in-react-f7ea1a6f93eb/

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can either change onInputChange method to use arrow function or you need to bind this for the onInputChange function.

Using arrow function:

onInputChange = (event) => {
  this.setState({ input: event.target.value });
};

Using bind:

<ImageLinkForm onInputChange={this.onInputChange.bind(this)} onButtonSubmit={this.onButtonSubmit.bind(this)} />
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