To add a favicon to your React app, you can follow these steps:
Create a
favicon.ico
file: You can use an image editor to create a.ico
file with the icon you want to use.Place the
favicon.ico
file in thepublic
directory: Create apublic
directory in the root of your React app if it doesn't exist already. Place thefavicon.ico
file in this directory.Add the link tag to your HTML: Open the
public/index.html
file and add the following link tag to the<head>
section:
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
This will link to the favicon.ico
file in the public
directory.
- Restart your development server: If your development server is already running, you will need to stop it and restart it for the changes to take effect.
Once you have completed these steps, you should see your favicon in the browser tab and address bar.