useHints (utils/client-hints.tsx)

react-router-saas-template · app/utils/client-hints.tsx · typescript · MIT
ui

Client hints utilities for server-side rendering with React Router, providing theme and timezone data via cookies.

// Source: https://github.com/janhesters/react-router-saas-template | License: MIT | Copyright 2025 Jan Hesters
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * This file contains utilities for using client hints for user preference which
 * are needed by the server, but are only known by the browser.
 */
import { getHintUtils } from "@epic-web/client-hints";
import {
  clientHint as colorSchemeHint,
  subscribeToSchemeChange,
} from "@epic-web/client-hints/color-scheme";
import { clientHint as timeZoneHint } from "@epic-web/client-hints/time-zone";
import { useEffect } from "react";
import { useRevalidator } from "react-router";

import { useOptionalRequestInfo, useRequestInfo } from "./request-info";

const hintsUtils = getHintUtils({
  theme: colorSchemeHint,
  ti

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key