Skip to main content

@dialstack/sdk-dev / react/src / useUpdateHandlerWithSetter

Function: useUpdateHandlerWithSetter()

TypeScript
function useUpdateHandlerWithSetter<T, H>(
component,
handler,
onUpdated
): void;

Defined in: sdk/react/src/react/useUpdateWithSetter.ts:82

useUpdateWithSetter for a callback prop: when the host stops passing it, the setter is called once with undefined, so the element stops calling a handler the host has let go of. Other props keep their last value instead, since clearing them would need a per-setter reset to defaults.

Type Parameters​

T​

T extends HTMLElement

H​

H

Parameters​

component​

T | null

handler​

H | undefined

onUpdated​

(component, handler) => void

Returns​

void