SSE Hooks

useSSR

Custom hook that detects the current environment (Browser, Server, or Native) and capability support (Workers, EventListeners).

Installation

npx sse-tool add use-ssr

Usage

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

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

API

Return Value

Returns UseSSRReturn.

Object containing boolean flags for the current environment.

Changelog

No recent changes.
Built with Love • © 2026