platform-bible-react
    Preparing search index...

    Function useEvent

    • Adds an event handler to an event so the event handler runs when the event is emitted. Use papi.network.getNetworkEvent to use a networked event with this hook.

      Type Parameters

      • T

      Parameters

      • event: undefined | PlatformEvent<T>

        The event to subscribe to.

        • If event is a PlatformEvent, that event will be used
        • If event is undefined, the callback will not be subscribed. Useful if the event is not yet available for example
      • eventHandler: PlatformEventHandler<T>

        The callback to run when the event is emitted

        WARNING: MUST BE STABLE - const or wrapped in useCallback. The reference must not be updated every render

      Returns void