HeadlinesBriefing favicon HeadlinesBriefing.com

Tyaff: Lightweight React Alternative Built in Six Days

Hacker News •
×

Developer Tyaff launched a new virtual DOM library for JavaScript that challenges React's approach to memoization and component updates. Built over six days, the library emphasizes minimalism with a custom diff/patch algorithm and microtask-based update batching. Unlike React's memo() which blocks entire subtrees, Tyaff's memo() only freezes the current component while children maintain independent update chains.

The library supports mutable data from any source—including global stores, singletons, or window objects—without requiring props drilling through the component tree. This pull-based context system lets components directly access values via this.context(key) rather than the traditional Provider/Consumer pattern. Props destructuring works directly in function signatures, and keys remain unique across the entire render to preserve component instances during reparenting.

Performance optimizations target bulk operations like reverse, swap, and reparenting, claiming faster execution than React across 14 benchmark scenarios. The API includes portals with deferred mounting, fragment support with keys, and factory-based component creation with automatic method binding.

Built through human-AI collaboration involving Qwen, GLM, and Gemini for research and optimization, Tyaff targets modern browsers with ES6 module support and ships under the MIT license.