useFavicon
Reads and updates the current favicon.
Usage
import { useFavicon } from "@siberiacancode/reactuse";
const favicon = useFavicon();Example
const favicon = useFavicon("/light.ico");
return (
<button onClick={() => favicon.set("/dark.ico")}>
Current: {favicon.href}
</button>
);initialFavicon:
const favicon = useFavicon("https://example.com/favicon.ico");Type Declarations
import type { Dispatch, SetStateAction } from "react";
export type UseFaviconReturn = [string, Dispatch<SetStateAction<string>>];
export declare const useFavicon: (initialHref?: string) => {
href: string;
set: (favicon: string) => void;
};