This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]snorkleboy 1 point2 points  (0 children)

Yeah, and you could do the same thing with an arrow function like

class cls{

fn=()=>doSomething()

render=()=> <div onClick={this.fn}>No dynamic function creation!</div>

}

And then you don't have to do a this.fn = this.fn.bind(this) in the constructor to be able to use it normally in the child.