Skip to content

SSR FAQ

Can I create a session during server rendering?

No. Initialize on the client after hydration. Capability detection is SSR-safe, but listeners require a browser environment.

Do I still need dispose()?

Yes — on the client, call lifecycle.dispose() when the shell unmounts. Disposed sessions cannot be restarted.

Example

ts
import { isBrowser, createBrowserLifecycle } from "@jayoncode/browser-lifecycle";

if (isBrowser()) {
  const lifecycle = createBrowserLifecycle({ autoStart: true });
  // …subscribe…
  // on unmount: lifecycle.dispose();
}

SSR · Lifecycle FAQ · Overview

An ecosystem of independent, headless TypeScript libraries engineered for modern web development. Every package includes interactive playgrounds and documentation that evolves alongside the code.