Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Utilize @babel/plugin-proposal-class-properties by using… #243

Merged
merged 1 commit into from
Dec 16, 2018

Conversation

tomegz
Copy link
Contributor

@tomegz tomegz commented Dec 16, 2018

… class properties in class components

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 93.586% when pulling f5ac576 on tomegz:improvement/class-properties into 50992a8 on patw0929:master.

@tomegz
Copy link
Contributor Author

tomegz commented Dec 16, 2018

There is no need for using .bind with this plugin, we can use class properties. Ex.:

class MyClass extends React.Component {
  constructor() {
    super()
    this.someMethod = this.someMethod.bind(this)
  }

  someMethod() {
    // ...
  }
}

can be simply replaced by:

class MyClass extends React.Component { 
  someMethod = () => {
    // ...
  }
}

@patw0929 patw0929 merged commit 49cb852 into patw0929:master Dec 16, 2018
andrewsantarin pushed a commit to andrewsantarin/react-intl-tel-input that referenced this pull request Feb 2, 2022
Improvement: Utilize @babel/plugin-proposal-class-properties by using…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants