An open API service indexing awesome lists of open source software.

https://github.com/jpalumickas/use-window-focus

React Hook to check if window is focused
https://github.com/jpalumickas/use-window-focus

hacktoberfest hooks javascript react react-hooks

Last synced: about 1 year ago
JSON representation

React Hook to check if window is focused

Awesome Lists containing this project

README

          

# use-window-focus

React Hook to show if window is focused or not

## Installation

```sh
yarn add use-window-focus
```

## Usage

```jsx
import React from 'react';
import useWindowFocus from 'use-window-focus';

export default () => {
const windowFocused = useWindowFocus();

return (


{windowFocused ? 'Focused' : 'Not focused'}

);
}
```

## License

The package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).