-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Hey! This was going to be a Discord comment, but I decided to post it here for documentation purposes.
A couple of things I learned building use-colyseus:
- The SDK should be small and precisely targeted using the state because that's where the difficulty lies. You don't need to wrap connecting, disconnecting, or any other room feature.
- React and Colyseus are different by definition. The former uses an immutable data model, while the latter uses a mutable one.
- Using Colyseus with React on your app is relatively easy. It takes some effort, but it's doable. Creating a general-purpose SDK to use the Colyseus state with React is hard.
The two key problems:
- The main goal of a Colyseus React SDK is to prevent unnecessary re-renders on state updates. To do that, it needs to implement selectors properly and know exactly which piece of the Colyseus state the user is trying to access.
- The second critical problem is keeping an immutable copy of that part of the state and tracking updates. Any update below the tracked node of the state tree needs to trigger a new copy of the node containing the updated data.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
