UNPKG

@multisynq/react

Version:

React bindings for Multisynq

11 lines (10 loc) 512 B
import { useModelRoot } from './useModelRoot'; /** Hook that gives access to the Model specified by an id of this Multisynq session. * Can be used to read Model properties (including other referenced Models), * and to publish events to the Model or to subscribe to Model events using the other hooks. */ export function useModelById(id) { var _a; const model = useModelRoot(); return (_a = model === null || model === void 0 ? void 0 : model.getModel(id)) !== null && _a !== void 0 ? _a : null; }