useIsFocused
Read whether this page is focused in the server-confirmed route tree.
Import
import { useIsFocused } from '@bedrock-core/navigation';
Signature
useIsFocused(): boolean
Parameters
None. The hook uses the current page scope.
Returns
true when the page's route is focused through every containing navigator.
Usage
function EditorStatus(): JSX.Element {
const focused = useIsFocused();
return <Text maxLength={16}>{focused ? 'Editing' : 'Inactive'}</Text>;
}
Notes
Configure the screen, a containing screen, or the root for server navigation. Compilation rejects this hook when its page can navigate locally, because native selection does not execute JavaScript focus reads.