by zevyoura · 9y ago · 0 comments
If you did this.foo = this.foo.bind(this, props.bar) in the constructor then it would be the same function each time.
In general binding like that in the constructor works only if you depend on props, but at that point, there isn't a need to bind at all since you can just reference the prop in the callback.
eg: it's going to be used as a event callback but you want the function signature to be foo(bar, event). Then you get the benefits of partial application without the problems of currying a new function each time its called.
source: have used this a lot for event handlers, especially when dealing with on 3rd party code.