Answer the question
In order to leave comments, you need to log in
What does this handleChange = (name) => ({ target }) => {} syntax mean?
handleChange = (name) => ({ target }) => {
this.setState({ [name]: target.value });
};
Answer the question
In order to leave comments, you need to log in
https://learn.javascript.ru/arrow-functions-basics
Function returns a function
handleChange returns a function with a state change.
it is most likely used something like this:
<input onChange={() => handleChange('name')} />
in handleChange you pass the name of the property in state in the second input target function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question