useHostElement()

Use useHostElement() to retrieve a reference to the current component's host element.

In this example, we have added all of the host element APIs in a single location.

  • tagName: is used to set a host element's tag name to something other than <div>.
  • <Host>: is used to data bind the component's host element.
  • useHostElement(): is used to retrieve a reference to the host element instance.

DOM Elements references are serializable within the context of Qwik.

Edit:Tutorial content|Tutorial app