I am pretty new to React. On the internet I often see code where every onChange event (for example from an input field) has its own function and in the constructor there is that bind method called. Couldn't I just use an arrow function for the event to update the state?
Just like
onChange={(e) => this.setState({text: e.target.value})}
Aucun commentaire:
Enregistrer un commentaire