main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
408 bytes
|
Line | |
---|
1 | import { useEffect } from 'react';
|
---|
2 | var useFavicon = function (href) {
|
---|
3 | useEffect(function () {
|
---|
4 | var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
---|
5 | link.type = 'image/x-icon';
|
---|
6 | link.rel = 'shortcut icon';
|
---|
7 | link.href = href;
|
---|
8 | document.getElementsByTagName('head')[0].appendChild(link);
|
---|
9 | }, [href]);
|
---|
10 | };
|
---|
11 | export default useFavicon;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.