score:4

Accepted answer

i've never it actively discouraged. the part of the documentation you are referring to is when you aren't passing extra arguments.

when you are passing arguments, the way you have presented is exactly the way to do it.

edit the exception would be if the arguments are somehow constants (i can't think of a case when they would be, just flagging).

this pattern (the one you presented) is important especially for handlers within loops, where each item needs to call a callback/handler, but forward on an id or key or index.

score:1

the alternative is to use .bind but it's not recommended because a new function is created upon each render() call.

updateprogress(arg, event) {
  console.log(arg, event); // prints: 1 proxy {dispatchconfig: object ...
}

render() {
  return
    ...
    <button onclick={this.updateprogress.bind(this, 1)}>increase</button>
}

Related Query

More Query from same tag