How to sync boolean values

What’s the suggested way to sync boolean values?

In our case, we are syncing a toggle inside a form that can only be true or false.

example-toggle: true

I suggest that you walk through the getting-started section.

This section (this is the fourth chapter) in particular explains how you sync data like this.

Alternatively, use something like SyncedStore, that makes this even easier.

Somehow, I didn’t fully understand the Map Type, even if this seems to be the easiest type afterwards.

After it clicked, it’s totally clear to me.

ymap.set('example-toggle', true)
ymap.get('example-toggle') // => true

As I couldn’t find resources in the web on how to simply sync a boolean, I hope this answer is helpful to others as well.

1 Like