Is it good to use arrow functions in render methods?
Yes, You can use. It is often the easiest way to pass parameters to callback functions. But you need to optimize the performance while using it.
class Foo extends Component {handleClick() {console.log('Click happened');}render() {return <button onClick={() => this.handleClick()}>Click Me</button>;}}
Note: Using an arrow function in render method creates a new function each time the component renders, which may have performance implications
May 22, 2022
425
Read more
What is React?
November 06, 2022
ReactJSHow to programmatically trigger click event in React?
November 06, 2022
ReactJS