Skip to main content

The ComponentInstance object

The ComponentInstance object can be used to check component instance ID or handle lifecycle events.

ComponentInstance properties#


Unique ID of the current component instance. Can be used to differentiate connected users, for example, in chat.

ComponentInstance methods#


Override this function with your own and it will be executed when component instance gets destroyed.

export const component: DraymanComponent = async ({ ComponentInstance }) => {
  ComponentInstance.onDestroy = () => {    console.log(`Component instance was destroyed!`);  };
  return () => {    return <h3>Hello, world!</h3>;};