SSE Hooks

useFavicon

GitHub
Custom hook that sets the document favicon.

Installation

npx sse-hooks add use-favicon

Usage

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

// Basic usage
useFavicon("/assets/favicon-dark.ico");
// With options
useFavicon("/assets/notification-badge.ico", {
  preserveFaviconOnUnmount: false, // Revert when component unmounts
  type: "image/png",
});

API

Parameters

Prop Default Type
options

{}

UseFaviconOptions

Configuration options.

href-

string

The URL of the favicon to set.

Returns

Return Value Default Type
return-

void

Hook return value

Types Aliases

No specific type aliases defined for this component.

Changelog

81fa5 — feat: add useAutoSave and useCallbackRef hooks with comprehensive documentation

Built with Love • © 2026