Interface IUseSignalProps<SENDER, ARGS>

Props for the UseSignal component

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

Type Parameters

  • SENDER
  • ARGS

Properties

children: ((sender?, 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

Type declaration

    • (sender?, args?): ReactNode
    • Parameters

      Returns ReactNode

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, 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.

Type declaration

    • (sender, args): boolean
    • Parameters

      Returns boolean

signal: ISignal<SENDER, ARGS>

Phosphor signal to connect to.