
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-user-idle
Advanced tools
This project is inspired by and forked from https://github.com/ReactTraining/react-idle .
This project is inspired by and forked from https://github.com/ReactTraining/react-idle .

Notifies or break your app when the user is idle.
When the user is idle you can do things like preload some code-split bundles, download images that haven't been scrolled to, etc. Also useful to break the entire app to reduce serve burden.
npm install react-user-idle
# or
yarn add react-user-idle
And then import it:
// using es modules
import Idle from 'react-user-idle'
// common.js
const Idle = require('react-user-idle').default
childrenOnce the component state idle comes to true, children will be rendered and will never gone.
This is useful when you wanna user to reload the page or to do some important things.
If you'd like to render in response to changes in user activity, children should be a function.
timeoutHow long before notifying that the user is idle in seconds.
throttleSeconds, using lodash/throttle to improve the preformance when user actions go fast
onChangeCalled whenever the user's activity state changes, a great time to change the owner component's state, or to kick off some imperative work like pre-fetching code-split bundles or images.
import Idle from 'react-user-idle'
render () {
return (
<Idle
timeout={3600}
throttle={5}
onChange={() => console.log('report to server to record and do stat things')}
>
<Modal title="Connection Lost">
Long time no action, you should refresh this page to reconnect.
</Modal>
</Idle>
)
}
import Idle from 'react-user-idle'
preload = (idle) => {
if (idle) {
console.log('preload images or other resoures')
}
}
render () {
return (
<Idle
timeout={3600}
throttle={5}
onChange={this.preload}
>
{
idle => idle && <Indicator>Preloading some resources</Indicator>
}
</Idle>
)
}
FAQs
This project is inspired by and forked from https://github.com/ReactTraining/react-idle .
The npm package react-user-idle receives a total of 4 weekly downloads. As such, react-user-idle popularity was classified as not popular.
We found that react-user-idle 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.