
Carlos Zabala Roqueme
PreguntaPor qué cuando utilizo esta forma para hacer la función handleChange
handleChange(e) { this.setState({ firstName: e.target.value }); }
Cuando escribo en la caja de texto me sale el siguiente error
Pero cuando se implementan las arrow functions si funciona
handleChange = e => { this.setState({ name: e.target.value }); };

Greimer Abel Pérez Guzmán
Ya que tendrías que,por así decirlo, anclar este método a "this", y "this" apuntará a este componente.

Greimer Abel Pérez Guzmán
Es mucho más sencillo creando la función de flecha
Rene Eduardo Corrales Torrez
import React from 'react' class BadgeFrom extends React.Component{ constructor(props){ super(props); this.state = { firstName: '', lastName: '', jobTitle: '', email: '', twitter: '' }; this.handleChange = this.handleChange.bind(this); }

Carlos Zabala Roqueme
Vale, perfecto gracias

Juan Luis Rojas León
Si utilizas handleChange(e) tienes que hacer el
.bind
this
Y las
funciones flecha
this
bind