Constructor of the message type to subscribe to.
Invoked whenever a matching message is published and the filter (if any) accepts it.
Optionalfilter: (message: TMessage) => booleanOptional predicate invoked with the actual typed message; only when it returns true
will callback be invoked. Useful for narrowing on message content
without re-subscribing.
Subscribes to messages of type TMessage from the nearest MessengerScope (or the Arc root messenger) for the lifetime of the calling component. The subscription is automatically cleaned up on unmount.
The callback does not need to be wrapped in
useCallback— a ref is used internally so stale-closure issues are avoided without forcing the caller to memoize.