Skip to content

useFavicon ​

Hook that manages the favicon

browser
test coverage
Last changed: last month

Installation ​

Library
CLI
Manual
typescript
import { useFavicon } from '@siberiacancode/reactuse';

Usage ​

typescript
const { href, set } = useFavicon('https://www.google.com/favicon.ico');

Demo ​

Api ​

Parameters

NameTypeDefaultNote
initialFavicon?string-The initial favicon. If not provided, the current favicon will be used

Returns

UseFaviconReturn

Type declaration ​

typescript
import type { Dispatch, SetStateAction } from 'react';

export type UseFaviconReturn = [string, Dispatch<SetStateAction<string>>];

Source ​

Source • Demo

Contributors ​

D
debabin
debabin
H
hywax
hywax

Released under the MIT License.