react-manual-bind-to-arrow
Convert constructor-time .bind(this) assignments into arrow class fields.
Usage
bash
Explore community-led codemods to migrate, optimize, and transform your codebase.
Build your own codemod and share it with the community.
Convert this.method = this.method.bind(this) to arrow class property
Build your own codemod and share it with the community.
1 class Component extends React.Component {
2 constructor() {
3 super();
4 const self: any = this;
5 self._onMapResize = debounceCore(this._onMapResize.bind(this), 100);
6 self.onClick = this.onClick.bind(this);
7 }
8 onClick() { }
9 onMapResize() { }
10 }
11