Closed
Description
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.