We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c90921a commit e27386fCopy full SHA for e27386f
index.js
@@ -266,13 +266,17 @@ export function useDocumentTitle(title) {
266
267
export function useFavicon(url) {
268
React.useEffect(() => {
269
- const link =
270
- document.querySelector("link[rel*='icon']") ||
271
- document.createElement("link");
272
- link.type = "image/x-icon";
273
- link.rel = "shortcut icon";
274
- link.href = url;
275
- document.getElementsByTagName("head")[0].appendChild(link);
+ let link = document.querySelector(`link[rel~="icon"]`);
+
+ if (!link) {
+ link = document.createElement("link");
+ link.type = "image/x-icon";
+ link.rel = "icon";
+ link.href = url;
276
+ document.head.appendChild(link);
277
+ } else {
278
279
+ }
280
}, [url]);
281
}
282
0 commit comments