Skip to content
Discussion options

You must be logged in to vote

I was able to make it work in an imperative way using useEffect in our PageWrapper component that wraps the content of every page:

const useCustomHead = ({ title }: { title: string }) => {

	// selectors that retrieve the amount of unread messages and notifications...

	React.useEffect(() => {
		document.title = fullTitle;

		// Update favicon
		const link: HTMLLinkElement =
			document.querySelector("link[rel~='icon']") ||
			document.createElement('link');
		link.rel = 'icon';
		link.type =
			hasTalkUnviewed || hasNotificationUnviewed
				? 'image/svg+xml'
				: 'image/x-icon';
		link.href = hasTalkUnviewed
			? '/static/main-icons/message.svg'
			: hasNotificationUnviewed
				? '/stat…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lucasbasquerotto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant