import { useState } from "react"; import "./LobbyPage.scss"; import { Socket } from "socket.io-client"; import { attachHandlerToUpdateLobbyEvent, ClientEvent } from "interface"; export interface LobbyPageProps { initialPlayerNames: string[]; gameCode: string; socket: Socket; } const LobbyPage = (props: LobbyPageProps) => { const { initialPlayerNames, gameCode, socket } = props; const [playerNames, setPlayerNames] = useState(initialPlayerNames); attachHandlerToUpdateLobbyEvent(socket, (event) => { setPlayerNames(event.playerNames); }); const startGame = () => socket.emit(ClientEvent.START_GAME); return (