favicon react render
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
favicon react render
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
how to change favicon dynamic in react js
import React from "react";
function getFaviconEl() {
return document.getElementById("favicon");
}
function App() {
const handleGoogle = () => {
const favicon = getFaviconEl(); // Accessing favicon element
favicon.href = "https://www.google.com/favicon.ico"; };
const handleYoutube = () => {
const favicon = getFaviconEl();
favicon.href = " https://s.ytimg.com/yts/img/favicon-vfl8qSV2F.ico"; };
return (
<div className="App">
<h1>Dynamically changing favicon</h1>
<button onClick={handleGoogle}>Google</button> <button onClick={handleYoutube}>YouTube</button> </div>
);
}
export default App;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us