@solidjs/universalEach slot is a Mesh with an attached BoxGeometry, MeshBasicMaterial, and DataTexture. Swap them, change the box width (a constructor argument), or unmount them, and watch the WebGL memory counters.
@solidjs/universal knows nothing about events. A prop like onClick reaches the renderer as an ordinary prop, so the renderer stores it, and a small event system does what the browser does for DOM elements:
slots group. B calls stopPropagation(), so its clicks stay on B.:hover. A hovered box turns yellow, because the handler writes a signal that drives the material's color prop.setPointerCapture(), so it keeps getting moves even when the pointer leaves it. The spin mutates rotation directly, without a signal.slots group gets one, as a DOM click goes to the common ancestor.pointerout: its owner is gone, so its handlers must not run. The component clears its own hover state with onCleanup.Try it: hover a box, click A then B and compare the group count, press on A and drag sideways past B, or unmount the boxes while one is hovered.
This example has its own canvas and WebGLRenderer, so its GPU counters stand alone. Each box waits for a texture from a slow loader. The left and middle boxes ask for the same texture, so they share one. The right box has its own.
createMemo. Until it arrives, Solid's <Loading> shows a wireframe box. The boundary works through the three renderer like any other component.onCleanup (naive), or in the cleanup of an effect, which runs only once the replacement is committed (committed). I expected naive to dispose the texture on screen. It does not: in Solid 2.0.3, the onCleanup of the run on screen waits until its replacement lands. A run that never reached the screen is cleaned up at once. I found this behavior only by testing, not in the docs, so committed is the strategy to rely on.Animation needs code that runs every frame, outside Solid's reactivity. The frame loop is plain JavaScript: each frame it runs its subscribers, calls a beforeRender hook, and draws. The Solid binding adds two things: useFrame(), which unsubscribes when its component unmounts, and flush() as the beforeRender hook.
rotation on the three object. Signal: one callback writes a time signal, and each box reads it in its rotation prop, so Solid updates 100 props every frame. Switch and compare the update time.flush() before render, the lag is 0 frames. Turn flush off and it becomes 1.This section has no canvas: TypeScript does the checking. In Solid 2, solid-js does not own JSX types. Each renderer package provides its own jsx-runtime types, and a file picks one with jsxImportSource. These types derive each element's props from its three.js class and match what the renderer does with them.
three namespace accept <sphereGeometry />, which this renderer cannot create.position takes [x, y, z], because the renderer calls position.set(...value). A bare number or a Vector3 instance is a type error, because set() would get the wrong arguments. color takes a string, a number or [r, g, b]. args are checked against the constructor, events exist only on Object3D, and ref receives a node whose object has the element's class.@ts-expect-error must be an error. If the types accept one of those lines, the check fails.three: about 14,700 and 0.13 s (TypeScript 7).jsxImportSource per file. A merged namespace works for this catalogue. Across all of three, four tags clash with DOM and SVG: audio, source, line and path. A merged namespace also cannot tell which renderer owns a tag, so <div> inside <mesh> type-checks.checkJs, the four scenes on this page have 6 JSX errors. render() from @solidjs/universal expects a single node, while a JSX expression is typed as the wider JSX.Element. And in plain JavaScript, a helper that returns [x, y, 0] is a number[], not a tuple. Props, refs, events, <Show>, <For> and <Loading> all check.View the renderer · View the scenes: renderer, events, async, frame loop · Back to the main demo