bengreenier / bengreenier/overlayed
refactor react+es6 method syntax
- Dominant language
- TypeScript
- Stars
- 28
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Per [this review comment](https://github.com/bengreenier/overlayed/pull/32#discussion_r222398794) we can refactor our es6 methods to be "autobound" to the React `this` instance, cleaning up code by removing the need for `this.callback = this.callback.bind(this)`.
For instance:
```
class Ex {
constructor() {
this.method = this.method.bind(this)
}
public method() {
// do work
}
}
```
to
```
class Ex {
public method = () => {
// do work
}
}
```
> Note: need to see how the linter + typescript feel about this, if they complain it may not be a fit.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked review comment and pull request 32, then inspect the React components for constructor bindings matching the issue's example. Check how the linter and TypeScript handle class property arrow methods, and run the project's available checks. Done means suitable methods no longer need explicit binding and those checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100