Reactjs ES Lint在构造函数变量上没有抛出未使用的vars错误

Reactjs ES Lint在构造函数变量上没有抛出未使用的vars错误,reactjs,eslint,Reactjs,Eslint,我有一个组件如下所示: class NavPane extends Component { constructor(props) { super(props); let lastX = 0; } NavOnTouchStart = (e) => { this.lastX = e.touches[0].clientX; } NavOnTouchMove = (e) => { const currentX = e.touches[0].

我有一个组件如下所示:

class NavPane extends Component {
  constructor(props) {
    super(props);
    let lastX = 0;
  }
  NavOnTouchStart = (e) => {
    this.lastX = e.touches[0].clientX;
  }
  NavOnTouchMove = (e) => {
    const currentX = e.touches[0].clientX;
    if (currentX > this.lastX + 10) {
      this.props.toggle();
    }
    this.lastX = currentX;
  }
  render() {
    return (
      <Collapse
        ...
      </Collapse>
    );
  }
}

export default onClickOutside(NavPane);
类导航窗格扩展组件{
建造师(道具){
超级(道具);
设lastX=0;
}
NavOnTouchStart=(e)=>{
this.lastX=e.touchs[0].clientX;
}
NavOnTouchMove=(e)=>{
const currentX=e.touchs[0].clientX;
如果(currentX>this.lastX+10){
this.props.toggle();
}
this.lastX=当前x;
}
render(){
返回(
试试这个:

  constructor(props) {
    super(props);
    this.lastX = 0;
  }
试试这个:

  constructor(props) {
    super(props);
    this.lastX = 0;
  }