MCPcopy
hub / github.com/bvaughn/react-window / useIsRtl

Function useIsRtl

lib/core/useIsRtl.ts:4–19  ·  view source on GitHub ↗
(
  element: HTMLElement | null,
  dir: HTMLAttributes<HTMLElement>["dir"]
)

Source from the content-addressed store, hash-verified

2import { isRtl } from "../utils/isRtl";
3
4export function useIsRtl(
5 element: HTMLElement | null,
6 dir: HTMLAttributes<HTMLElement>["dir"]
7) {
8 const [value, setValue] = useState(dir === "rtl");
9
10 useLayoutEffect(() => {
11 if (element) {
12 if (!dir) {
13 setValue(isRtl(element));
14 }
15 }
16 }, [dir, element]);
17
18 return value;
19}

Callers 1

GridFunction · 0.90

Calls 1

isRtlFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…