Skip to content

Remove bindMethods in favor of Class properties #294

@dmiller9911

Description

@dmiller9911

Class properties are on their way to making it into the spec. Moving to them will also align us better with the greater React community since many projects have adopted this syntax. Example of the change is below:

Before

class SomeComponent extends Component {
  constructor(props) {
    super(props);
    this.state = {
      isLoading: false,
    };
    bindMethods(this, ['handleClick']);
  }
  handleClick() {}
}

After

class SomeComponent extends Component {
  state = {
    isLoading: false,
  };
  handleClick = () => {}
}

TC39 Proposal
Stage Explanations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions