use-window-focus
v1.4.4
Published
React Hook to show if window is focused or not
Maintainers
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.
