useMessageBus

This hook is used to subscribe to a channel on the message bus. The hook takes care of initialization and unsubscribing after the component unmounts

Installation

import { useMessageBus } from 'uxp/components';

Signature

function useMessageBus(context: any, channel: any, callback: any): MessageBusHook

Examples

useMessageBus(props.uxpContext, "visitor-arrival", (payload, channel) => {
     getVisitorArrivals();
     Toast.info("Your visitor is here")
     return "updated"
})

Last updated