Posts

Showing posts with the label SolidJS

SolidJS Explained: React-Like Code, Svelte-Like Speed

Introduction React (covered earlier) re-renders components when state changes, diffing a virtual DOM to find what updated. Svelte (batch 8) compiles that work away at build time. SolidJS, released in 2021, takes a third path that feels familiar to React developers but performs like Svelte: write JSX that looks like React, and get updates through fine-grained reactivity — only the exact DOM nodes that depend on changed state update, with no virtual DOM at all. It is consistently among the fastest frameworks in benchmarks, and the reason is architectural, not a trick. Signals and fine-grained updates Solid's core is signals — reactive primitives that track dependencies automatically: createSignal — holds a value and returns a getter and setter: const [count, setCount] = createSignal(0) . Reading count() inside a component subscribes that exact text node to the signal. Fine-grained updates — when setCount runs, only the DOM nodes that read count() update. No component re-ren...