Interface IUseSignalProps<SENDER, ARGS>

Props for the UseSignal component

interface IUseSignalProps<SENDER, ARGS> {
    children: (sender?: SENDER, args?: ARGS) => ReactNode;
    initialArgs?: ARGS;
    initialSender?: SENDER;
    shouldUpdate?: (sender: SENDER, args: ARGS) => boolean;
    signal: ISignal<SENDER, ARGS>;
}

Type Parameters

  • SENDER
  • ARGS

Properties

children: (sender?: SENDER, args?: ARGS) => ReactNode

Function mapping the last signal value or initial values to an element to render.

Note: returns React.ReactNode as per https://github.com/sw-yx/react-typescript-cheatsheet#higher-order-componentsrender-props

initialArgs?: ARGS

Initial value to use for the args, used before the signal emits a value. If not provided, initial args will be undefined.

initialSender?: SENDER

Initial value to use for the sender, used before the signal emits a value. If not provided, initial sender will be undefined

shouldUpdate?: (sender: SENDER, args: ARGS) => boolean

Given the last signal value, should return whether to update the state or not.

The default unconditionally returns true, so you only have to override if you want to skip some updates.

signal: ISignal<SENDER, ARGS>

Lumino signal to connect to.