Function useDispatchEventOnLoad

  • A hook that dispatches an event on component load/update.

    Parameters

    • type: string

      event name

    • payload: Record<string, string> = {}

      event payload

    • context: EventTarget = window

      event target, default window

    Returns void

    useDispatchEventOnLoad("nosto:ns-serp", { sectionId: "ns-serp" });

    return (
    <div
    class="ns-serp ns-d-flex ns-flex-column ns-flex-md-row ns-font-inherit ns-p-4 ns-my-0 ns-mx-auto"
    data-nosto-element="search"
    >
    // Your content here
    </div>
    );