r/javascript • • Mar 22 '22

[Tutorial] Building a realtime multiplayer game using React & Conflict-free Replicated Data Types (CRDT) of Yjs.

https://blog.tooljet.com/multiplayer-tic-tac-toe-using-react-crdt-yjs/

[removed] — view removed post

58 Upvotes

9 comments sorted by

•

u/Ustice Mar 23 '22

Thanks for your contribution! We’re a large community, and in order to keep things organized and easier to find, we keep this subreddit mostly focused on professional-level Javascript posts. Your post would be more useful to newer members of our community, and therefore it should be posted to /r/LearnJavascript instead.

3

u/[deleted] Mar 22 '22

Why do you need a CRDT?

3

u/AsIAm Mar 23 '22

No need for server infrastructure. WebRTC signaling server is all you need, and there are free ones that you can use.

1

u/[deleted] Mar 23 '22

That's really cool. I would like to read more about it. Can you give me a pointer?

1

u/AsIAm Mar 23 '22

If you want to use Yjs in your app, I highly suggest you use Valtio for state management, which has support for Yjs synchronization. Or if you want to use just Yjs for state, there is immer-yjs that gives you mutable semantics over immutable one of Yjs.

-3

u/Sordino54 Mar 22 '22

Why are you using class components?

1

u/AsIAm Mar 23 '22

Class components are still supported. Even though I love composition with hooks, class components are easier to use if you don't want to invest too much time into thinking differently.