A type describing a custom element renderer
Customize how a DOM node is rendered. If .renderer is set on a given instance of VirtualElement, this function will be called every time that VirtualElement is rendered.
The actual DOM node created for a VirtualElement during rendering.
On render, host is created and its attrs are set/updated via the standard routines in updateContent. host is then handed off to this function.
The render function is free to modify host. The only restriction is is that render should not modify any attributes set by external routines (ie updateContent), as this may cause thrashing when the virtual element is next rendered.
Will be populated with the .attrs and .children fields set on the VirtualElement being rendered.
Optionalunrender?: ((host, options?) => void)
Optional cleanup function for custom renderers. If the .renderer field of a VirtualELement is set, and if .renderer.unrender is defined, when the element is changed or removed its corresponding DOM element will be passed to this function immediately before it is removed from the DOM.
unrender is not required for for simple renderers, such as those
document.createElement(). However, for certain
rendering techniques explicit cleanup is required in order to avoid
For example, if render calls
ReactDOM.render(..., host), then
there has to also be a corresponding implementation of unrender that
ReactDOM.unmountComponentAtNode(host) in order to prevent
a memory leak.
the DOM element to be removed.
Will be populated with the .attrs and .children fields set on the VirtualElement being unrendered.
Generated using TypeDoc