talira

Fast 3kB alternative to React with the same modern API

open sourceMITfree

Preact is a 3 KB JavaScript UI library with the same modern API as React: components, hooks and a Virtual DOM, the thinnest possible abstraction over the real DOM, with real event handlers and batched updates. It runs in the browser without a build step, is small enough to embed in widgets or parts of a page, and accepts standard HTML attributes like class and for. Aliasing react to preact/compat in your bundler lets it use components from the React ecosystem.

Problems it solves

  • a smaller alternative to React for a page where bundle size matters
  • build an embeddable widget with React-style components but a tiny bundle
  • use React components with a much lighter runtime
  • write components without a build step in the browser

Features

  • 3 KB
  • React-compatible API with hooks
  • preact/compat for React components
  • no build step required
  • batched updates

Alternatives

The same job

These do what Preact does.

  1. Lit Simple. Fast. Web Components.
  2. Svelte Web development for the rest of us
  3. Vue.js The Progressive JavaScript Framework
  4. React The library for web and native user interfaces
  5. SolidJS Fine-grained reactive UI
  6. Alpine.js Your new, lightweight, JavaScript framework

Compare Preact with the top 3