Select the best answer.
React.useEffect(() => { connect(roomId); return () => disconnect(roomId); }, [roomId]);