Created by Piyush Garg about a year ago
No description provided
Is there a way to do the same thing without singleton? If I am not creating a service(class) but just a normal async function which created a socket connection
I'm used to use useRef on App to save and reuse previous connection. Making "new" operation doesn't return new instance is really new idea to me, will try that on my project :)
best explanation ever on internet.
But what's wrong with React.useEffect if we give dependency array as empty? Wont it work then because then it will establish the connection only once?