Generic Lobby
This is a library that adds the ability to view and join rooms within a application lobby
Installation
npm install generic-lobby
yarn add generic-lobby
Usage
app.tsx
import {GenericLobby,GenericLobbyProvider} from "generic-lobby"
cosnt myLobby = new GenericLobby({lobbyId:"my-custom-lobby"})
const App = ()=>{
<GenericLobbyProvider>
<AppComponents/>
</GenericLobbyProvider>
}
export default App
appcomponent.tsx
import { useGetLobby } from "generic-lobby"
const AppComponent = () => {
const lobby = useGetLobby()
return (
<ul>
{lobby.map((room) => (
<li>
<span>Room:{room.room}</span>
<span>Public:{room.public}</span>
<span>Users:{room.users}</span>
</li>
))}
</ul>
)
}