A declarative JavaScript UI library that compiles JSX to real DOM updates with fine-grained reactivity instead of a Virtual DOM.
preactjs/preact
A fast, roughly 4kB React-compatible UI library with the same modern component API, built on a Virtual DOM.
Open-source alternative to:React
- Stars
- 38,951
- Forks
- 4,428
- Open issues
- 43
- Last commit
- 22 hours ago
What is it?
Preact is a lightweight UI library that offers the React component model, including ES6 classes, hooks and functional components, in a much smaller footprint. It is aimed at developers who want React-style development without the bundle size of React itself.
The library includes JSX support, a Virtual DOM, DevTools, hot module replacement and server-side rendering with seamless hydration. A preact/compat alias allows many React libraries to run on Preact with extensive compatibility. Rendering is asynchronous with a pluggable scheduler, and the diff algorithm is designed to minimize DOM operations.
Preact supports all modern browsers. Templates can be written in JSX or in HTM, which uses standard JavaScript tagged templates.
Key features
- 01Familiar React API including class components, hooks and functional components
- 02preact/compat alias for running many React libraries
- 03Built-in JSX, Virtual DOM, DevTools and hot module replacement
- 04Server-side rendering with seamless hydration
- 05Asynchronous rendering with a pluggable scheduler
Use cases
- Shipping a React-style front end where bundle size matters, such as performance-sensitive pages
- Migrating an existing React app gradually using the compat alias
- Adding interactive components to server-rendered sites
Quick start
- 1
Install Preact from npm
npm install preact - 2
Import render and h in your app and render a component into document.body
Topics
FAQ
- What is preact?
- A fast, roughly 4kB React-compatible UI library with the same modern component API, built on a Virtual DOM. Preact is a lightweight UI library that offers the React component model, including ES6 classes, hooks and functional components, in a much smaller footprint. It is aimed at developers who want React-style development without the bundle size of React itself.
- Is preact free to use? What license does it have?
- preact is open source under the MIT license. Check the license terms before using it in commercial products.
- Is preact still maintained?
- Actively maintained. The last commit to preact was on Oct 24, 2026.
- What can I use preact for?
- Shipping a React-style front end where bundle size matters, such as performance-sensitive pages Migrating an existing React app gradually using the compat alias Adding interactive components to server-rendered sites
- How do I install preact?
- Install Preact from npm: npm install preact Import render and h in your app and render a component into document.body
- Where can I get preact?
- The source code and installation instructions are on GitHub: https://github.com/preactjs/preact
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An extremely fast, React-like JavaScript library for building high-performance user interfaces on the client and server.
A JavaScript library for building interactive user interfaces from composable components, usable on the web, server and native platforms.
Omi is a Web Components framework with JSX, signal-based reactivity, a router and Tailwind support, aimed at building reusable custom elements.
A compiler that turns declarative web components into efficient JavaScript that surgically updates the DOM.
A React framework for building full-stack web applications, with Rust-based tooling for fast builds.