Answers for "which one is better arrow functions or using bind in react?"

0

which one is better arrow functions or using bind in react?

{
  "presets": ["module:metro-react-native-babel-preset"],
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": false }],
    ["@babel/plugin-transform-arrow-functions", { "spec": true }]
  ]
}
Posted by: Guest on June-16-2021
0

which one is better arrow functions or using bind in react?

import React from 'react';
import { boundMethod as bind } from 'autobind-decorator';
class MyComponent extends React.Component {
  constructor(props) {
    super(props)
  }

  @bind
  clickHandler() {
    console.log( this )
  }

  render() {
    return <button onClick={this.clickHandler}>Click Me</button>
  }
}
Posted by: Guest on June-16-2021

Code answers related to "which one is better arrow functions or using bind in react?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language