Skip to content

Optimizations for loading JS files, including Lodash (more of a doc issue) #206

Closed
@chrisvfritz

Description

@chrisvfritz

I see this pattern in the constructors of example components:

_.bindAll(this, 'myFunction');

Putting aside the fact that all of lodash was being imported when only a single function was needed, I think even that single function is unnecessary, since a class property (stage-1) can be used for the same effect:

myFunction = (arg1, arg2) => {
  // ...
};

Even if you decide to later remove the stage-0 preset from .babelrc, I'd personally much prefer the use of ES5's .bind, since it'll also do the job.

this.myFunction = this.myFunction.bind(this)

Then Lodash can be completely removed as a dependency.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions