Skip to content

Cannot read property 'state' of undefined at onSave in 07 Form #151

@qkreltms

Description

@qkreltms

Error happens when Button from "../../common/components/form"; clicked.
It is because onSave doesn't bound on the constructor in MemberPageContainer class.

Original code

constructor(props: Props) {
super(props);
this.state = {
member: {
id: -1,
login: '',
avatar_url: '',
}
};
this.onFieldValueChange = this.onFieldValueChange.bind(this);

  constructor(props: any) {
      super(props)

      this.state = {
        member: {
          id: -1,
          login: "",
          avatar_url: ""
        }
      };

      this.onFieldValueChange = this.onFieldValueChange.bind(this);
      //You should include this
      this.onSave = this.onSave.bind(this);
  }

Metadata

Metadata

Assignees

No one assigned

    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