News for hackers. Stuff that matters.
Re:I love React Hooks by tekkk on Wednesday February 20, 2019 @04:14AM (#19206688)
So can someone explain what the author means by the problem of #3:

>However, there are times when we need to pass an extra parameter. In those cases, we cannot use bind because we cannot use bind with arrow functions.

But you can pass the extra argument to the arrow function directly: `onChange={handleChange('name')}`. And use it as:

  handleChange = (field) => (e) => {
    this.setState({ [field]: e.target.value });
  }
Sure it still has the problems of arrow functions I think the arguments against it were worded poorly.

There are no comments on this comment yet.