useWindowFocus
Detect whether the window
is focus. In a non browser environment, it always returns false
.
API
function useWindowFocus(): boolean;
Example
Is window focus: false
import React from "react";
import { useWindowFocus } from "@lilib/hooks";
function Example() {
const focus = useWindowFocus();
return <div>Is window focus: {focus.toString()}</div>;
}
export default Example;