bengreenier / bengreenier/overlayed

refactor react+es6 method syntax

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
enhancement tooling
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.