no you should not use an empty array as a dependency but you can include the socket so that the useEffect runs only when something happens on the socket.Thatshow I did mine and it worked very well.
useEffect(()=>{
},[socket])