titlehook for dynamic tab titles

This commit is contained in:
2023-03-15 15:04:04 +01:00
parent f1e3d4a790
commit c2095c8ae7
3 changed files with 26 additions and 6 deletions

View File

@@ -2,9 +2,12 @@ import useWebSocket from "react-use-websocket";
import React from "react";
import {useParams} from "react-router";
import {GHButton} from "../components/Button";
import useTitle from "../../utils/TitleHook";
const Room = () => {
useTitle('Mau!');
const {roomId} = useParams();
const WS_URL = `ws://localhost:5062/room/${roomId}`;
@@ -38,7 +41,10 @@ const Room = () => {
<div>
<h1>Room {roomId}</h1>
<GHButton onClick={handleLeaveRoom}>Leave Room</GHButton>
<form>
<form onSubmit={(event) => {
event.preventDefault();
handleSend();
}}>
<input type="text" name="message" placeholder="Send a message" value={message}
onChange={handleMessageChange}/>
<span onClick={handleSend}>Send</span>