Skip to content

jpalumickas/use-window-focus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-window-focus

React Hook to show if window is focused or not

Installation

pnpm add use-window-focus

Usage

import useWindowFocus from 'use-window-focus';

export const App = () => {
  const isWindowFocused = useWindowFocus();

  return (
    <div>
      <span>{isWindowFocused ? 'Focused' : 'Not focused'}</span>
    </div>
  );
}

License

The package is available as open source under the terms of the MIT License.

About

React Hook to check if window is focused

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •