'React js favicon with self-increasing badge

enter image description here

enter image description here

enter image description here

I have a basic icon, I would like to make sure that if for example I receive a message that I have not yet read, the icon shows me the number of unread messages.

As seen in the image above.

So how can I make sure that having a basic icon it can show me a badge on it with a number set by me.

For example, as you can see, discord changes automatically.

The first image is a normal icon.

The second image is used when there are unread messages.

The third image is used when a user is tagged, but this number increases, so I don't think there are as many images with all possible numbers, I think they are generated based on the normal image.

Can anyone help me out?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source