Skip to content

Documentation / @agentick/core / useOnUnmount

Function: useOnUnmount() ​

useOnUnmount(callback): void

Defined in: core/src/hooks/lifecycle.ts:54

Register a callback to run when the component unmounts.

Parameters ​

callback ​

UnmountCallback

Returns ​

void

Example ​

tsx
useOnUnmount((ctx) => {
  console.log("Component unmounting");
  ctx.setState("initialized", false);
});

Released under the ISC License.