which one is better arrow functions or using bind in react 3f

Solutions on MaxInterview for which one is better arrow functions or using bind in react 3f by the best coders in the world

showing results for - "which one is better arrow functions or using bind in react 3f"
Juan Pablo
11 Mar 2020
1{
2  "presets": ["module:metro-react-native-babel-preset"],
3  "plugins": [
4    ["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": false }],
5    ["@babel/plugin-transform-arrow-functions", { "spec": true }]
6  ]
7}
8
Mira
16 May 2016
1import React from 'react';
2import { boundMethod as bind } from 'autobind-decorator';
3class MyComponent extends React.Component {
4  constructor(props) {
5    super(props)
6  }
7
8  @bind
9  clickHandler() {
10    console.log( this )
11  }
12
13  render() {
14    return <button onClick={this.clickHandler}>Click Me</button>
15  }
16}
17