ReactModel

ReactModel

This class extends the Croquet Model class to automatically update React state when the model changes.

We recommend that your models inherit from this class, as it requires less code, but you can still use the Model class. Keep in mind that if you do, you won't be able to use the useReactModelRoot hook, and will have to publish and subscribe to the input and output events on your own. For more details about this, please check the Event overview and the View.publish, Model.subscribe, Model.publish, and View.subscribe methods.

Extends

  • Model

Methods

# handleViewJoin(viewId) → {void}

This method is called whenever the ReactModel receives a view-join event.

Parameters:
Name Type Description
viewId string

The id of the view that just connected

Returns:
Type
void

# handleViewExit(viewId) → {void}

This method is called whenever the ReactModel receives a view-exit event.

Parameters:
Name Type Description
viewId string

The id of the view that just left

Returns:
Type
void