TanStackT
TanStack6mo ago
3 replies
spotty-amber

Getting headers inside of an SSR component

import { useEffect, useState } from "react";

export function useShortcutKey() {
  const [shortcutKey, setShortcutKey] = useState("Ctrl");

  useEffect(() => {
    const isMacOs = !!navigator?.userAgent?.match(/Macintosh;/);
    setShortcutKey(isMacOs ? "⌘" : "Ctrl");
  }, []);

  return shortcutKey;
}
is there a way to support this as an ssr component?
Was this page helpful?