etch icon indicating copy to clipboard operation
etch copied to clipboard

Null-elements are not allowed?

Open dy opened this issue 6 years ago • 1 comments

There are use-cases when it is not necessary to create an element for a component, for example, when we render WebGL/regl or canvas2d layers:

<canvas id="canvas">
<Grid canvas="#canvas" type="cartesian" />
<Plot canvas="#canvas" data={data} />
<Text canvas="#canvas" text="Test Plot" />

Would that be reasonable to disable strong assertion of instance.element property? Or not forcing render to return etch virtual-dom?

Faced this issue trying to make gl-component API compatible with etch.

dy avatar May 31 '18 16:05 dy

The simplest trick is using this.element = document.createTextNode('') and passing etch.update(this, false) to ignore rerender.

dy avatar May 31 '18 18:05 dy