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'; const App = () => { console.log("rendering app"); const client = new Client(); 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;