separated server calls
This commit is contained in:
parent
7cc159edd7
commit
45b4c7f7fc
1 changed files with 99 additions and 31 deletions
|
|
@ -1,22 +1,24 @@
|
|||
import React, {useState} from 'react';
|
||||
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';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import PlayerInfo from './PlayerInfo.tsx';
|
||||
|
||||
function App() {
|
||||
const [id, setId] = useState<string | null>(null);
|
||||
|
||||
return <>
|
||||
{id === null && <JoinForm onDone={name => setId(name)}/>}
|
||||
<ClientScreen/>
|
||||
{id == null || <Controls playerId={id}/>}
|
||||
{id === null && <JoinForm onDone={name => setId(name)} />}
|
||||
{id == null || <PlayerInfo playerId={id} />}
|
||||
<ClientScreen />
|
||||
{id == null || <Controls playerId={id} />}
|
||||
</>;
|
||||
}
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App/>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
|
|
|||
Reference in a new issue