Vidact – a compiler that turns React into direct DOM operations
Hacker News 热议:Vidact – a compiler that turns React into direct DOM operations(39 赞 / 18 评论,来源 vidact.dev)
一句话概要
Vidact compiles React components into direct DOM code. No Virtual DOM, no React runtime.
原文开头节选
Vidact reads your function components at build time and writes the DOM code for them. The component body runs once, at mount. A setState call after that reaches only the text nodes and attributes that read that state.
npx vidact my-app Beta. Vidact compiles a documented subset of React 19 and refuses the rest at build time.
Every example below is ordinary React, compiled by Vidact and mounted into this page.
import { useState } from ‘react’ export function Counter () { const [ count , setCount ] = useState ( 0 ) return ( < div > < button onClick = {() => setCount (count + 1 )}> Increment </ button > < output >Count: {count}</ output > </ div > ) } Result Increment Count: 0 Component calls 1 DOM mutations 0 Tree diffs 0 Counted live by a MutationObserver watching this demo.
(以上为原文节选,完整内容见下方”原文来源”)
这条动态今日登上 Hacker News 首页(39 赞 / 18 评论,来源 vidact.dev)。技术雷达每日自动聚合 AI 工程、后端架构、DevOps 方向的前沿动态;相关工程落地可浏览下方的相关服务与延伸阅读,或直接与我们团队交流。
原文来源: Hacker News