Making Referential Stability a Type in React and Preact

Making Referential Stability a Type in React and Preact

I have spent too many hours chasing unnecessary re-renders caused by unstable references in React and Preact. To solve this, I designed a type system that enforces referential stability directly in the code. By using a unique brand, developers can ensure that arrays and callbacks passed to memoized components remain stable, preventing silent performance regressions. This approach shifts the burden of optimization from the component boundary back to the caller, making type errors the primary guardrail against inefficient code.

An agent can't see a re-render it never rendered, but it can absolutely respond to a type error, that's the feedback loop it already runs on.

More from this day

2026-07-31