React中的Statics对象

Posted Visual Monitor

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React中的Statics对象相关的知识,希望对你有一定的参考价值。

statics 对象允许你定义静态的方法,这些静态的方法可以在组件类上调用。例如

var MyComponent = React.createClass({
  statics: {
    customMethod: function(foo) {
      return foo === bar;
    }
  },
  render: function() {
  }
});

MyComponent.customMethod(bar);  // true

 

以上是关于React中的Statics对象的主要内容,如果未能解决你的问题,请参考以下文章