The singleton pattern is a class that can have only one instance. By its design, whenever we attempt to create a new instance, it will either create an instance for the first time or return the one that was created previously.
How is this pattern useful? If we want to have a single manager for certain things, this comes in handy, whether it be an API manager or cache manager. For instance, if you need to authorize the API to get the token, you will only want to do this once. The first instance will initiate whatever work is necessary and then any other instance will reuse the work that has already been done. This use case was abused mostly by server-side applications, but more and more people have come to realize that there are better alternatives.
Such use cases can nowadays be easily countered by better patterns. Instead of creating a singleton pattern...