Answer the question
In order to leave comments, you need to log in
Declaring an event handler in React via simplified syntax - what does this line of code do? How to google details about it?
I'm learning react. Found a convenient option for declaring an event handler.
(without using constructor and bind).
handleClick = (event) =>{
...
};
Answer the question
In order to leave comments, you need to log in
it's just a class field that an arrow function is assigned to, the
arrow function doesn't have its own context, so you don't have to explicitly bind the context in the constructor,
it's just handy when you use something with "this" in methods, like this:this.setState({...});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question