import { useSyncExternalStore } from "react"; import { getInputPreferences, subscribeInputPreferences } from "./keybindRuntime"; import { inputBindingLabel, type InputDevice } from "./keybinds"; export function useInputBindingLabels() { const preferences = useSyncExternalStore(subscribeInputPreferences, getInputPreferences, getInputPreferences); return (device: InputDevice, id: string) => inputBindingLabel(device, preferences[device][id]); }