Package Exports
- use-window-focus
- use-window-focus/dist/use-window-focus.js
- use-window-focus/dist/use-window-focus.module.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-window-focus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
use-window-focus
React Hook to show if window is focused or not
Installation
pnpm add use-window-focusUsage
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.