React 单双击冲突

let count = 0;
class App extends Component {
    onClick = () => {
        count += 1;
        setTimeout(() => {
          if (count === 1) {
            console.log('single click: ', count);
          } else if (count === 2) {
            console.log('setTimeout onDoubleClick: ', count);
          }
          count = 0;
        }, 300);
    }
    
    render(){
        return (...)
    }
}

你可能感兴趣的:(React 单双击冲突)