LogoRobo.js
Packages@robojs/sync

SyncZone()

Function: SyncZone()

function SyncZone(props): Element

A context provider that establishes a sync zone with key prefix inheritance.

Zones enable:

  • Key prefix accumulation (nested zones combine prefixes)
  • Host inheritance (all children share the zone's host determination)
  • Component reusability (same component can be used in different zones)

Parameters

ParameterType
propsSyncZoneProps

Returns

Element

Examples

// Basic zone
<SyncZone id={['game', 'room1']}>
  <SyncBox id={['player']} />  // key becomes 'game.room1.player'
</SyncZone>
// Nested zones
<SyncZone id={['game']}>
  <SyncZone id={['board']}>
    <SyncBox id={['piece']} />  // key becomes 'game.board.piece'
  </SyncZone>
</SyncZone>
// Explicit host
<SyncZone id={['match']} hostRules="explicit" host={adminClientId}>
  <GameBoard />
</SyncZone>

On this page