React中的Statics对象

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

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

MyComponent.customMethod('bar');  // true

 

posted @ 2016-04-03 13:22  wanghualiang  阅读(1156)  评论(0编辑  收藏  举报