import React, { useEffect, useState } from 'react'; import logo from './logo.svg'; import './App.css'; import { WebsocketPlayingFieldComponent } from './components/PlayingField/PlayingField'; import { Client } from './client'; import { createBrowserRouter, RouterProvider } from 'react-router-dom'; import { GmPlayingFieldComponent } from './components/GmPlayingField/GmPlayingField'; interface AppProps { client: Client; } const App = ({ client }: AppProps) => { console.log("rendering app"); const [websocketUrl, setWebsocketUrl] = useState(undefined); useEffect(() => { client.registerWebsocket().then((url) => setWebsocketUrl(url)) }, [client]); let router = createBrowserRouter([ { path: "/gm", element: }, { path: "/", element: websocketUrl ? :
} ]); return (
); } export default App;