Option 1:
Use arrow functions
(with babel plugins) PS: - Experimental function
class MyComponent extends Component { handleClick = (args) => () => {
Option 2: Not Recommended
Define the functions of arrows in the render
class MyComponent extends Component { render() { const handleClick = () => {
Option 3:
Use binding in constructor
class MyComponent extends Component { constructor() { super(); this.handleClick = this.handleClick.bind(this); } handleClick() {
anoop source share