News for hackers. Stuff that matters.
Re:‘This’ in JavaScript by janci on Thursday August 03, 2017 @03:49AM (#14917729)
Better yet element.addEventListener("click", self.handleClick.bind(this))
Re:‘This’ in JavaScript by rayshan on Thursday August 03, 2017 @11:49AM (#14920585)
This is less performant, because bind creates a new function with new context. At the framework level, bind is avoided at all costs.
Re:‘This’ in JavaScript by janci on Friday August 04, 2017 @12:02PM (#14929670)
The overhead is not important, if you bind once. It becomes problem, if you do it too often, like in react render function.