react-inactivity
v1.0.4
Published
The react-inactivity hook offers the perfect solution for tracking user inactivity over a specific period of time.
Downloads
93
Maintainers
Readme
Installation
To install react-inactivity, simply run the following command:
For npm:
npm install react-inactivity
Yarn:
yarn add react-inactivity
pnpm:
pnpm add react-inactivity
Usage
This is a simple overview of how to set up this library with all the options.
// App.js
import { useReactInactivity } from 'react-inactivity'
function App() {
const { isIdeal } = useReactInactivity({ minute: 1 })
return (
<div className="App">
<header className="App-header">
<p>
Ideal for 1 min? -- {isIdeal.toString()}
</p>
</header>
</div>
);
}
export default App;
debug ([options])
You can also pass debug flag to display usefull logs in your cansole (this is default false).
const { isIdeal } = useReactInactivity({ minute: 1, debug: true })
Support and Suggestions
Submit any queries or suggestions in our Github Repo.