I do write code using both of these, but I want to have clarity on is there any difference between these two and if yes which one is the best one to use. ( which is the best practice and why? ) or is there no difference between these?
does use of Arrow functions have a performance impact, when used in a loop?
When we are passing an arrow function handler down to child components ( which is created in a loop ), does this impact the performance by anyway?
Can i by default stick to arrow function?
Arrow function:
renderPage = () => {
this.props.pdfData.getPage(this.props.pdfPageNumber).then(
this.handlePages();
);
}
Normal function with a bind:
constructor(){
super();
this.groupChange = this.groupChange.bind(this);
}
groupChange = (selectedOption: any) => {
this.setState({ selectedGroup: selectedOption });
if (selectedOption) {
console.log(`Selected: ${selectedOption.label}`);
}
}