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
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