SSE Hooks

useSSR

GitHub
Custom hook that detects the current environment (Browser, Server, or Native) and capability support (Workers, EventListeners). useful for avoiding hydration mismatches.

Installation

npx sse-hooks add use-ssr

Usage

example.ts
import { useSSR } from "./{hooks file}";

const { isBrowser, isServer } = useSSR();
if (isServer) {
  return <StaticLoader />;
}
return <ClientComponent />;

API

Parameters

Prop Default Type

Returns

Return Value Default Type
return-

UseSSRReturn

Hook return value

Types Aliases

No specific type aliases defined for this component.

Changelog

31af5 — Refactor useBattery hook and remove utility functions

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

2f161 — feat: add useConferenceSystem, useKbd, useMediaQuality, useNetworkInformation, usePortal, useRoleGuard, useScreenShare, useSymbol hooks

Built with Love • © 2026