Q:

Reconnecting web socket using React Hooks

I want to establish a web socket connection with the server. Reconnenct after
some time.
I am using react hooks.
I have tried to use useEffect hook.
But it is not working.
I have tried to use useRef hook.
But it is not working.
I have tried to use useState hook.
But it is not working.
I have