Repolode
preactjs

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. 1

    Install Preact from npm

    npm install preact
  2. 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