Component should be written as a pure functioneslintreact/prefer-stateless-fun 解决方案: 在class组件中添加state,即可 constructor(props) { super(props) this.state = {} }