Sometimes, we want to add favicon with React and Webpack.
In this article, we’ll look at how to add favicon with React and Webpack.
How to add favicon with React and Webpack?
To add favicon with React and Webpack, we can use the react-favicon
library.
To install it, we run
npm install react-favicon
Then we use it by writing
import Favicon from "react-favicon";
//...
ReactDOM.render(
<div>
<Favicon url="/path/to/favicon.ico" />
</div>,
document.querySelector(".react")
);
to add the Favicon
component and set the favicon location with the path
prop.
Conclusion
To add favicon with React and Webpack, we can use the react-favicon
library.