import React from 'react' ; export default function useFavicon ( path ) { React . useEffect ( ( ) => { const link = document . querySelector ( "link[rel*='icon']" ) || document . createElement ( 'link' ) ; link . href = path ; link . rel = 'shortcut icon' ; link . type = 'image/x-icon' ; document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( link ) ; } , [ path ] ) ; return null ; }