Tracks how long a state has been active
npm install react-user-activity-trackernpm i react-user-activity-tracker
import Tracker from 'react-user-activity-tracker';
function App() {
const [id, setId] = useState(0);
const changeId = (e) => {
setId(e.target.value);
}
return (
trackerId={id}
onTrackerIdChange={ (id, value) => console.log(${id} has been active for ${value} seconds. )}
trackerSubmitInterval={10}
onIntervalSubmit={ (id, value) => console.log(${id} has been active for ${value} seconds. )}
timeout={1500}
/>
)
}
``