How to auto log off when a user is inactive in ReactJS?
<p>I need to know if there is any API in REACT JS or HTML5 which provides the functionality of auto-log off when a user is inactive. My code is below I don't know what is wrong it is giving me the error startTimer is not defined and unnecessary binding. Please tell me where I am going wrong</p>
<pre class="lang-js prettyprint-override"><code>import React from 'react';
import ReactDOM from 'react-dom';
import './App.css';

class Toogle extends React.Component {
  constructor(props) {
    super(props);
    //step 1
    this.handleClick = this.handleClick.bind(this);
    this.startTimer=this.startTimer.bind(this)
  }
            
  handleClick() {
    console.log('Button is clicked');
    
    //  clearTimeout(timeoutTimer);
    startTimer() {
      var timeoutTimer = setTimeout(function() {
        window.location.href = '#/security/logout';
      }.bind(this), 1000);  
    }
  }

  render() {
    return (
      &lt;div onMouseMove={this.handleClick}&gt;
        Move the cursor over me
      &lt;/div&gt;
    );
  }
}

ReactDOM.render(
  &lt;Toogle /&gt;,
  document.getElementById('root')
);
</code></pre>