react frontend app (display screen, join)

This commit is contained in:
Vinzenz Schroeter 2024-04-07 00:33:54 +02:00
commit abdfdf2ec0

View file

@ -0,0 +1,22 @@
import React, {useState} from 'react';
import './index.css';
import ClientScreen from './ClientScreen';
import Controls from './Controls.tsx';
import JoinForm from './JoinForm.tsx';
import {createRoot} from 'react-dom/client';
function App() {
const [id, setId] = useState<string | null>(null);
return <>
{id === null && <JoinForm onDone={name => setId(name)}/>}
<ClientScreen/>
{id == null || <Controls playerId={id}/>}
</>;
}
createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App/>
</React.StrictMode>
);