为什么我应该在React类中使用`static`方法?

时间:2017-04-07 19:05:04

标签: javascript

我觉得我错过了static这件事的一些重要好处。

export default class ComponentName extends Component {
  static someMethod = () => {

  }

  static someVariable = {
    a: 'b'
  }

  render() {
    return (
      <View>
        <Text>ComponentName</Text>
      </View>
    );
  }
}

为什么我会使用此而不是常规const functionName = () => {}或变量?

0 个答案:

没有答案