Detect user activity with a custom useIdle React Hook

InstructorKent C. Dodds

Share this video with your friends

Send Tweet

If the user hasn't used your application for a few minutes, you may want to log them out of the application automatically in case they've stepped away from the machine and someone nefarious attempts to use their session. Let's checkout how you can create a custom React hook that wraps a regular npm module called activity-detector to solve this problem.