
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
react-idle-timer
Advanced tools
⚡️ Support for React 16
🚀 Support for Isomorphic React
Welcome to version 4 of IdleTimer! We have performed a complete rewrite of our build system and a refactor/ clean up of the source code. After accepting many pull requests things started to get ugly. We added test coverage and continuous integration tools (travis and codeclimate) that will automatically enforce style and test future pull requests.
There are a few breaking changes in version 4:
startOnLoad has been renamed to startOnMount in order to make more sense in a react context.activeAction has been renamed to onActive.idleAction has been renamed to onIdle.For the full patch notes please refer to the CHANGELOG
yarn add react-idle-timer
or
npm install react-idle-timer --save
Run
yarn exampleto build and run the exampleexample. The example is a create-react-app project. IdleTimer is implemented in the App Component.
import React, { Component } from 'react'
import IdleTimer from 'react-idle-timer'
export default class YourApp extends Component {
constructor(props) {
super(props)
this.idleTimer = null
this.onActive = this._onActive.bind(this)
this.onIdle = this._onIdle.bind(this)
}
render() {
return (
<IdleTimer
ref={ref => { this.idleTimer = ref }}
element={document}
onActive={this.onActive}
onIdle={this.onIdle}
timeout={1000 * 60 * 15}>
<h1>Child Components</h1>
</IdleTimer>
)
}
_onActive(e) {
console.log('user is active', e)
console.log('time remaining', this.idleTimer.getRemainingTime())
}
_onIdle(e) {
console.log('user is idle', e)
console.log('last active', this.idleTimer.getLastActiveTime())
}
}
To build the source code generated html docs run
yarn docsand opendocs/index.htmlin any browser. A markdown version is available here.
These events are bound by default:
true. Set to false to wait for user action before starting timer.true.true.Timestamp the user was last activeThe idle-js package is a lightweight JavaScript library for detecting user inactivity. It provides similar functionality to react-idle-timer but is not specifically designed for React. It can be used in any JavaScript application to detect idle state and perform actions based on user inactivity.
The react-idle package is another React component for detecting user inactivity. It offers similar features to react-idle-timer, such as detecting idle state and performing actions based on user inactivity. However, it may have a different API and set of features compared to react-idle-timer.
FAQs
Activity detection for React.js
The npm package react-idle-timer receives a total of 862,602 weekly downloads. As such, react-idle-timer popularity was classified as popular.
We found that react-idle-timer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.