React中的Statics对象

statics 对象容许你定义静态的方法,这些静态的方法能够在组件类上调用。例如spa

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

MyComponent.customMethod('bar');  // true
相关文章
相关标签/搜索