user2914191
user2914191

Reputation: 897

React binding "this" to external static method

I have 2 questions.

  1. Is it possible to bind "this" to an external static method? For instance, within a constructor of class A, declare B.staticMethod.bind(this).
  2. Is this normal practice?

Upvotes: 2

Views: 1068

Answers (1)

codejockie
codejockie

Reputation: 10864

  1. No you can't do that. Since it's a static method from another class there is no need to bind it. You simply call it like so: B.staticMethod().

  2. It is not a normal practice and you should never do that.

Upvotes: 1

Related Questions