# Inferno — Ultra-Fast React-Compatible UI Library > Inferno is a high-performance JavaScript UI library with a React-compatible API that delivers some of the fastest rendering benchmarks among virtual DOM libraries while keeping a small footprint. ## Install Save in your project root: # Inferno — Ultra-Fast React-Compatible UI Library ## Quick Use ```bash npm install inferno inferno-create-element # Or use the full compat layer: npm install inferno inferno-compat # Alias react/react-dom to inferno-compat in your bundler config ``` ## Introduction Inferno is a JavaScript library for building user interfaces that follows the React component model but prioritizes raw rendering speed and minimal bundle size. It achieves top-tier performance on JS Framework Benchmark by using a highly optimized virtual DOM diffing algorithm and compile-time optimizations through VNodeFlags. ## What Inferno Does - Renders UI components using JSX or hyperscript with a virtual DOM - Provides a React-compatible API surface through the inferno-compat package - Optimizes rendering with compile-time VNode type flags that skip unnecessary checks - Supports both class components and functional components with lifecycle hooks - Streams server-side rendered HTML for fast time-to-first-byte ## Architecture Overview Inferno compiles JSX into optimized createElement calls that attach VNodeFlags at build time, telling the diffing engine exactly what type each node is (element, component, text, etc.). This eliminates runtime type checking during reconciliation. The patching algorithm uses keyed diffing with a longest-increasing-subsequence approach to minimize DOM mutations. Server-side rendering streams HTML chunks progressively rather than serializing the entire tree. ## Self-Hosting & Configuration - Install core packages: `inferno`, `inferno-create-element`, and optionally `inferno-compat` - Use Vite, Webpack, or Rollup with the Inferno JSX plugin for build configuration - Alias `react` and `react-dom` to `inferno-compat` to migrate existing React codebases - Configure Babel or TypeScript with the Inferno JSX factory for compile-time optimizations - Deploy the built output as static files to any CDN or web server ## Key Features - Consistently top-ranked in JS Framework Benchmark for rendering speed - React compatibility layer allows reuse of many React ecosystem libraries - Small core library size (around 9 KB gzipped) - Server-side streaming renderer for improved time-to-first-byte - Compile-time VNodeFlags eliminate runtime overhead in the diffing algorithm ## Comparison with Similar Tools - **React** — Larger ecosystem and community, but heavier runtime and slower raw rendering benchmarks - **Preact** — Similar goal of a lightweight React alternative (3 KB), but Inferno is faster in synthetic benchmarks - **SolidJS** — Reactive fine-grained updates without virtual DOM, different mental model, comparable performance - **Svelte** — Compiler-based approach with no virtual DOM, smaller runtime, different component syntax - **Mithril** — Lightweight framework with built-in router and XHR, auto-redraw model instead of explicit state ## FAQ **Q: Can I use React libraries with Inferno?** A: Many React libraries work through inferno-compat. Libraries that depend on React internals or concurrent features may not be compatible. **Q: When should I choose Inferno over React?** A: Inferno shines when raw rendering performance and small bundle size are critical, such as in embedded devices, kiosks, or performance-sensitive dashboards. **Q: Does Inferno support hooks?** A: Inferno supports class component lifecycle methods and has its own hooks API. The inferno-compat layer also maps React hook calls. **Q: Is Inferno production-ready?** A: Yes. Inferno has been stable since v1.0 and is used in production environments where performance is a priority. ## Sources - https://github.com/infernojs/inferno - https://infernojs.org/docs/guides/getting-started --- Source: https://tokrepo.com/en/workflows/e1f56bce-42fe-11f1-9bc6-00163e2b0d79 Author: AI Open Source