Game-as-a-Service / Pandemic-Reign-of-Cthulhu

an interactive web game that brings the board game with the same title to digital implementation
GNU Affero General Public License v3.0
1 stars 0 forks source link

Frontend Status Store #53

Open wingtkw opened 8 months ago

wingtkw commented 8 months ago

@KalpasWang @sandytang886 Any suggestion on how to store the status in frontend?

e.g. how many cultists & shoggoths left? user info? turns left? that kind of thing

A library that I have used is named jotai which is a more atomic one compared with redux

https://jotai.org/docs/basics/comparison

wingtkw commented 8 months ago

here is a quick demo on the use of jotai you may view how it's done in the /feature/frontend/navbar branch

image

KalpasWang commented 8 months ago

jotai looks good

also one thing, do we need something like react query to manage our server state? or just manage it manually in jotai,

I haven't used react query, but it's very popular.

wingtkw commented 8 months ago

For managing server state I use react query before for rest api And it's quite easy to use

But I guess in our game We are mostly using socket as well for real time state change and update So I think socket io client is more appropriate in this case

KalpasWang commented 8 months ago

ok, I see👌

metalalive commented 7 months ago

It is time to document API endpoint to socket.io server, to let frontend people know how to interact with socket.io server. I will add more detail at here (by editing this comment) tomorrow morning if I have time .

Relevant discussion :