首页 > 随笔 > Vidact – a compiler that turns React into direct DOM operations

Vidact – a compiler that turns React into direct DOM operations

Hacker News 2026-09-03 04:34 1 阅读 查看原文
Write React. Ship the DOM. Vidact compiles your function components and hooks into direct DOM operations. No Virtual DOM, no re-renders, no React in the bundle. Every example below is ordinary React, compiled by Vidact and running on this page. import { useState } from 'react'export function Counter() { const [count, setCount] = useState(0) return (
Count: {count}
)} Counted live by a MutationObserver watching this demo. How it works Compile The compiler maps every expression to the values it reads. Code it cannot compile stops the build at its exact line. Mount once The component runs a single time and builds its DOM. There is no render loop and no tree to diff. Update surgically A state write runs only the updaters that read it: a text node, an attribute, a list row. Full-stack, the same way Vidact Start adds file routes, server loaders, SSR, hydration, and client navigation, all generated by the same compiler, so server and browser output match by construction. import { defineFileRoute } from '@vidact/start'const loader = async ({ params }) => ({ product: await findProduct(params.productId),})export function ProductRoute({ loaderData }) { return

{loaderData.product.name}

}export const Route = defineFileRoute({ loader, component: ProductRoute,}) Vidact is in beta. What is supported is documented; what is not fails at build time.