I know that there are already some threads about that, but I was not able to find an actual one.
So my question is, should I always use the bind approach or the arrow functions?
What are the pros/cons of them in 2020? From what I read I know, that (at least in 2018) the bind methods had a better performance.
Another question: Should I just bind the functions, which I call use in the render method via a click?
Here a small example
constructor(super) {
props(super)
this.firstBind = this.firstBind.bind(this);
this.secondBind = this.secondBind.bind(this;
}
render() {
return (
<Button title="First Bind" onClick={this.firstBind} />
<Button title="First arrow" onClick={this.firstArrow} />
)
}
firstArrow = () => {
//some outout
}
secondArrow = async() => {
//fetch some data from a database and output it
}
secondBind() {
//some output
}
async secondBind() {
//fetch some data from a database and output it
}
My goal is to understand it completely.
Thanks a lot!
Jan