The ComponentInstance object
The ComponentInstance object can be used to check component instance ID or handle lifecycle events.
ComponentInstance properties#
id#
Unique ID of the current component instance. Can be used to differentiate connected users, for example, in chat.
ComponentInstance methods#
onDestroy()#
Override this function with your own and it will be executed when component instance gets destroyed.
src/components/home.tsx
export const component: DraymanComponent = async ({ ComponentInstance }) => {
ComponentInstance.onDestroy = () => { console.log(`Component instance was destroyed!`); };
return () => { return <h3>Hello, world!</h3>;};