Skip to content

refactor react+es6 method syntaxΒ #37

@bengreenier

Description

@bengreenier

Per this review comment 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions