mrkeyoor.comAsk

preactjs/preacttested 25 Oct 2026commit 958adfa

preact review

Use Preact when its React-style component model suits your application and your team can own dependency, typing and production-output checks.

  • Install 1.4 s
  • README snippet failed
1,424/1,435tests passed
  • 964 KB on disk
  • 0 dependencies
Webevaluationupdated 24 Nov 2026
+7stars / 7d

Preact is a JavaScript library for building browser interfaces from reusable components. It has React-style components and hooks, plus a compatibility layer for React libraries. Its guide gives separate configuration for bundlers, Node and TypeScript.

Verdict

Use Preact when its React-style component model suits your application and your team can own dependency, typing and production-output checks. Our October source build completed in 4 seconds, and its test step reported 1,424 passes. The November consumer attempt installed npm Preact 11.2.0, then failed while parsing a README JSX example taken from checkout 1fbc07f67bd8. Skip Preact if unchanged React-package behavior is a release requirement and your team cannot maintain the integration checks.

Preact infographic: build browser interfaces from reusable components, plus our test result and who it suits
Tested 24 November 2026: the README snippet failed with "SyntaxError: Unexpected token". Before that: 25 Oct: 1,424 of 1,435 tests passed; npm install took 1.4 s.

We ran it

Lab card: what happened when we ran preact
Lab card from our sandbox run
Screenshot of preact (preactjs.com)
preactjs.com
Install✓ · 52s345 packages · 238 MB
Build✓ · 4s
Tests✓ · 24s1424 passed · 0 failed · 11 skipped of 1435 (vitest)
Repo390 files~62,574 lines of source · 2 MB · 8 CI workflows · tests dir

Answers from our run

Does preact build from source?

Dependencies installed in 52 seconds (345 packages), and the build succeeded in 4 seconds. We cloned commit 958adfa into a clean Debian container with 3 CPUs and no project-specific setup.

Do preact's tests pass?

Yes. The project's own test command finished in 24 seconds and reported 1424 passed, 0 failed, 11 skipped (vitest).

Who should not use preact?

Teams requiring React dependencies to work unchanged without owning compatibility configuration.

What are the alternatives to preact?

React, Svelte. Use Preact when its React-style component model suits your application and your team can own dependency, typing and production-output checks.

Setup3/5In our 2026-11-24 run it installed in 1.4 s, but the README’s “Tutorial: Building UI with Preact” example failed as written with “SyntaxError: Unexpected token ''”.Editor’s note: The October source workflow passed and the November plain-Node JSX attempt failed. Neither run assesses a complete browser application setup.
Docs3/5The README has an install section (“Getting Started”) and usage in the same section, but its “Tutorial: Building UI with Preact” example failed as written in our 2026-11-24 run (“SyntaxError: Unexpected token ''”).Editor’s note: The guide explains JSX compilation and separate tool aliases; the documented setup paths were not all exercised.
Community5/5Last push on 2026-11-22, 39,012 stars and maintainers answered or closed 10 of the 10 most-discussed issues we sampled.Editor’s note: Named discussions contain responses and workarounds, but this sample does not measure support response times or adoption.
Maturity5/5Latest release 11.2.0 on 2026-11-06, repository created 2015-09-11 and its test suite passed in our sandbox (1,424 of 1,435 passed).Editor’s note: The October source suite passed; production migration and the separately installed November package lack application acceptance results.

How we score

Discussed on

  1. hnPreact Signals159 points
  2. hnPreact: Fast 3kb React Alternative with the Same API, Components and Virtual DOM117 points
  3. hnPreact : a smaller, faster React alternative74 points
  4. hnPreact, React alternative without weird Patents License67 points
  5. hnPreact rendering in a web worker67 points

Who it’s for

Developers evaluating a different UI runtime against a concrete application JavaScript budget.
React users prepared to check dependency behavior, TypeScript declarations and production output.
Teams choosing between a Vite application and browser modules with HTM.
Component-library authors who test the published package in a separate consuming application.

Who it’s NOT for

Teams requiring React dependencies to work unchanged without owning compatibility configuration.
Library authors treating a working development page as sufficient acceptance for published output.
Developers expecting an unprocessed JSX example to execute directly in plain Node.
Teams choosing a runtime solely from generic speed or SEO promises.

Setup reality

Our October 25 source run used commit 958adfa and pnpm. Installation completed in 52 seconds, recorded 345 dependencies and used 238 MB on disk. The build completed in 4 seconds. Tests completed in 24 seconds, with Vitest reporting 1,424 passed, 0 failed and 11 skipped out of 1,435. The recorded sandbox configuration was 3 CPUs, 8 GB RAM and image lab-node:22.

The November 24 quickstart used checkout 1fbc07f67bd8 to supply the README example. Separately, npm install preact@latest installed Preact 11.2.0 in 1.4 seconds. That installation occupied 964 KB and installed 0 packages besides Preact. Running the unedited 22-line README JSX block with Node failed in 0.1 seconds with exit 1 and SyntaxError: Unexpected token '<'. The container configuration was 2 CPUs, 4 GB RAM and image lab-node:22.

The guide recommends Vite for newcomers and documents browser modules with HTM as a route without JSX compilation. It also supplies separate React-alias instructions for Node and TypeScript. The November package installation and the README checkout are distinct source inputs.

Preact's source build passed in our October run, while a November attempt to execute its README JSX example directly with Node stopped at SyntaxError: Unexpected token '<'. The November checkout supplied the example; npm separately installed Preact 11.2.0. Use Preact when its component model suits your application and you can own the compatibility configuration. Keep React when maintaining those substitutions would outweigh the benefit you seek: the Preact migration guide describes separate Node and TypeScript configuration.

What people use Preact for

Preact users describe building applications, publishing component libraries and avoiding extra layout wrappers, with concrete examples in GitHub discussions. These accounts help distinguish application authoring from distributing reusable output. In the Preact 11 roadmap discussion, lukejacksonn said they had committed a year to building Preact apps almost exclusively and enjoyed its tools and community. Their account describes sustained use rather than a comparison between application runtimes.

lipe-dev built the @logrock/pebbles component library in Preact library mode, then reported failures after publication. Importing a component produced a missing default-export warning and an undefined-component error. That is a different adoption path from building an application whose components stay inside one build. The discussion includes a later configuration workaround from another participant, making published output a practical acceptance target for anyone maintaining a design system.

EmielM described using fragments to simplify flex layouts by avoiding extra wrappers. That discussion predates native fragment support; the later roadmap lists fragments among the Preact X additions. Component testing appears in another concrete account: xtuc described mounting components in jsdom and checking the DOM. Together, these examples cover application work, library distribution, layout composition and tests without turning individual experiences into an adoption score.

What you can do with Preact

Preact creates browser interfaces from trees of components and elements, according to its repository tutorial. Components are functions or classes that describe their output. The tutorial uses JSX, an HTML-like syntax, and also names HTM, which uses JavaScript tagged templates. Its render() function accepts a tree and a parent DOM element; later calls update the existing tree. Those are the basic pieces behind both a small interface and a component-based application.

The getting-started guide documents new applications and React migration. Its browser-module example imports h and render, creates an h1 with h('h1', null, 'Hello World!'), and renders it into document.body. That example is browser code. The guide explicitly distinguishes it from JSX, which requires a build step, and presents HTM as JSX-like authoring in standard JavaScript. Choose the execution path before copying a tutorial block.

React-library reuse adds a separate configuration decision. An alias tells a tool to substitute a package or import path. Preact's guide documents substitutions for bundlers, Node execution and TypeScript resolution because those tools read different configuration. For an application written with Preact's own imports, this migration work has a different role than it does for an existing React dependency tree. The useful starting question is which imports your application actually executes and which declarations its compiler reads.

What happened when we ran it

Our November 24 quickstart installed npm Preact 11.2.0 separately from the checkout that supplied its README example. The run used a fresh unprivileged container configured with 2 CPUs, 4 GB RAM and image label lab-node:22, with no secrets or published ports. The installed package was obtained from npm rather than built from that checkout.

Hands-on question Answer Verdict Why
Did the quickstart clone step complete? The clone step took 1 second. Completed The step records recipe quickstart-lib.
Which package did npm install? Preact 11.2.0, in 1.4 seconds. Installed The command was npm install preact@latest.
How much installed disk space did it use? 964 KB in node_modules. Recorded The installed-size step measured disk usage after installation.
How many other packages were installed? 0 packages besides Preact. Recorded The dependency-count step gives that count.
Did the unedited README JSX block run with Node? It failed in 0.1 seconds, exit 1, with SyntaxError: Unexpected token '<'. Failed Node stopped at the JSX syntax.
What finding did the run retain? The README snippet did not run as written in this execution path. Failure retained The finding repeats the syntax error.
Did teardown complete? Teardown was ok. Completed The teardown record reports ok.

The separate October 25 source run used commit 958adfa, pnpm, 3 CPUs, 8 GB RAM and image label lab-node:22. Our source installation completed in 52 seconds, and the build completed in 4 seconds. These figures describe the source repository workflow, while November's smaller installation describes a package-consumer workflow.

Source-repository step Result from our October 25 run
Install Succeeded in 52 seconds; 345 dependencies recorded; 238 MB on disk
Build Succeeded in 4 seconds
Tests Succeeded in 24 seconds; Vitest reported 1,424 passed, 0 failed and 11 skipped out of 1,435

The October checkout scan recorded 390 files, approximately 62,574 source lines and a 2 MB checkout, alongside 8 CI workflow files, a tests directory and monorepo workspaces. It found no Dockerfile. These were different tasks using different source inputs: October built and tested repository source, while November installed an npm package and attempted a README example from a separate checkout. The guide's statement that JSX requires a build step explains the execution requirement relevant to that parser error.

Where people get stuck: aliases, declarations and published output

Preact's guide gives separate alias instructions for bundlers, Node and TypeScript, while user reports add published-output and custom-element failures. The distinction is practical: a browser build resolving an import says little about which package a direct Node process resolves or which declarations TypeScript checks. The following table keeps documented configuration separate from participant reports, so a migration can assign each check to the tool that performs it.

Symptom or boundary What the source says to check Outcome and scope
React imports executed directly by Node The guide uses package.json dependency aliases to npm:@preact/compat Documented separately from bundler aliases
React-library declarations cause TypeScript errors The guide supplies TypeScript paths and offers skipLibCheck skipLibCheck bypasses full declaration-file checking
A published component is undefined 657kbps externalized preact and set build.commonjsOptions.esmExternals to ['preact'] Another participant's reported solution in discussion #7152
Custom-element JSX children conflict with DOM children Issue #1180 discusses replacing the inherited children type or defining attributes Acknowledged workaround followed by declaration-merging failures

The official guide says bundler aliases do not work for imports executed in Node, and it explains that TypeScript has its own resolution process. Some React libraries use types absent from preact/compat; the guide offers skipLibCheck to avoid a full check of dependency declarations. That option changes what TypeScript checks. It does not supply the missing declarations, so a successful compile with that setting has a specific meaning.

In Vite discussion #7152, 657kbps reported a build configuration solution using external: ['preact'] and esmExternals: ['preact']. The original report included a warning that a default export was missing from Preact. In custom-element issue #1180, later replies describe a global.d.ts declaration that still failed to compile, including after an explicit include-array suggestion. For library authors, consuming the published artifact in a separate application exercises the output that downstream users receive.

Signals track state dependencies alongside hooks

Signals can coexist with hooks and class components, according to the Preact team's Signals introduction. The article describes a signal as a value-bearing object and explains that reading its value lets a component subscribe to changes. Its examples use signal, computed and .value. This gives an existing component tree a way to adopt the mechanism gradually instead of requiring every state variable to change together.

The article addresses shared-state updates and the work involved in deciding where to apply memoization, which reuses results when inputs stay the same. The authors report trying their prototype in several applications and finding the state access intuitive. They also describe passing a signal directly into JSX so a text value can update without rendering the whole component. These are attributed descriptions of the mechanism and the team's experience, useful when locating a specific state path to evaluate.

Preact 11 metadata and announcements describe different events

Repository metadata records release 11.2.0 on November 6, 2026, while the Preact account's November 24 post announces Preact 11 and lists features. That upstream post names Hydration 2.0, automatic ref forwarding and diffing that uses moveBefore where supported. November 24 dates the post. The November quickstart's installed version is independently recorded as 11.2.0, keeping the package identity separate from both the announcement and the README checkout.

The older roadmap issue #2621 explicitly calls itself a collection of thoughts, rather than a concrete Preact 11 feature list. It also summarizes additions made in the 10.x line, including fragments and hooks. Read release metadata, an announcement and a roadmap according to those different purposes. Hydration connects client behavior to server-rendered HTML; ref forwarding concerns access passed through components. Both give upgrading teams specific behavior to include in application acceptance.

Historical browser and testing reports need their version attached

Issue #453 reports a medium-sized application working on Preact 6.4.0 and hitting a stack overflow after moving to Preact 7. The reporter specifically names Internet Explorer 11. The discussion's proposed responses include replacing the Promise polyfill or bypassing Promise-based scheduling. In issue #430, another participant said a proposed text-node fix still failed their IE11 example, and the maintainer asked them to try a different build command. These are release-specific troubleshooting histories.

Historical testing discussion #658 includes jsdom-based DOM checks and an endorsement for behavior other than dimensions or layout. It also contains Enzyme compatibility troubleshooting and a missing react/lib/ReactContext module report. DOM assertions and browser layout checks answer different questions. For an application with editors, focus handling or layout-sensitive components, a test plan should identify which behavior belongs to each environment rather than inheriting every package suggestion from that old thread.

Preact vs alternatives: choosing between Preact, React and Svelte

Preact's documented React migration requires tool-specific substitutions; Svelte describes a component compiler. Those are supported architectural differences that can guide a shortlist before application measurements. The React choice here follows from Preact's own Node and TypeScript instructions, while the Svelte README describes its compiler. Choose according to the component model and configuration your team wants to maintain.

Choice Supported distinction Decision
Preact vs React Preact documents React-import substitutions for several tools Keep React when maintaining those substitutions outweighs your reason to migrate
Preact vs Svelte Svelte compiles declarative components into DOM-updating JavaScript Consider Svelte when you want that compiler model
Vite with JSX vs browser modules with HTM Preact documents both authoring routes; JSX requires compilation Choose the build workflow your application needs

A useful application comparison accounts for the complete route: core Preact, hooks, compat, optional Signals and other dependencies all contribute to its output. A core-library headline and an installed-directory size describe different quantities. The November measurement of 964 KB is disk usage after installation, so it belongs beside the installation result rather than in a browser-download comparison.

What the other reviews get wrong

Keval Padia's Medium comparison calls Preact identical to React in API and structure, while Preact's guide acknowledges missing React-library types. The Medium article's identity claim is broader than that documented compatibility boundary. Its general promise of seamless package reuse also needs to accommodate the published-library failure in Vite discussion #7152. Familiar component syntax and compatibility configuration are concrete benefits; they do not make every dependency path identical.

The Ricky Spears comparison claims older-browser support without extensive polyfills. Preact 6.4.0 and Preact 7 had different outcomes in the IE11 application reported in issue #453, so older-browser advice needs a release attached. A separate stale instruction appears in the standalone preact-compat repository: that package targets Preact 8.x and earlier. Its own notice tells Preact X users to uninstall it and replace aliases with preact/compat.

FAQ

Preact is a JavaScript UI library whose README describes components as functions or classes that return a description of their output. That answers the software identity question in the repository tutorial. The questions below follow migration, testing and component-integration discussions, with answers tied to the documented configuration or the named historical report. They separate a practical starting point from a claim about every application.

What is Preact?

Preact builds user interfaces from components and elements, with hooks and a React compatibility layer described in its README. Its tutorial introduces render() as the function that creates and updates a tree inside a parent DOM element. The getting-started guide then separates browser-module authoring from JSX compilation and documents the aliases used when bringing React imports into a Preact application.

Should I build with React or switch to Preact?

Keep React when your team does not want to maintain the compatibility substitutions documented by Preact. Consider Preact when you control the component surface and can check the dependencies your application uses. The guide's Node and TypeScript sections give concrete migration work to estimate, while the published-library report adds a reason to exercise production output in a consuming application.

Why does my published Preact component library fail when imported?

Vite discussion #7152 reports a missing default export and an undefined-component error after publication. 657kbps later reported solving a similar problem by externalizing Preact and configuring build.commonjsOptions.esmExternals. The useful diagnostic distinction is between components working during library development and the imports emitted into the distributed package. Start by matching the warning and emitted imports to the report before adopting its configuration.

How do I fix custom element typings with JSX.IntrinsicElements?

Issue #1180 discusses a conflict between DOM children, typed as HTMLCollection, and JSX children. Participants proposed replacing the inherited type or defining the element's accepted attributes. Later replies describe declaration merging that still failed, including a global.d.ts file. The thread supports investigating the declaration and compiler inputs, rather than presenting a catch-all intrinsic-element declaration as a complete solution.

How do I write unit tests for Preact components?

Mounting a component and checking its DOM is the approach xtuc describes in issue #658. The maintainer endorsed jsdom for behavior other than dimensions and layout. That distinction gives tests a useful division: DOM assertions can inspect rendered elements and behavior, while browser checks cover layout-sensitive results. The same historical thread contains Enzyme alias problems, including a missing React internal module.

Does Preact support fragments without adding wrapper elements?

The Preact X roadmap summary lists fragments among the additions to the 10.x line. Fragments group children without adding a wrapper element. EmielM's earlier layout discussion explains why this was useful for flex layouts. Read the historical span and custom-wrapper suggestions as responses from before native fragment support, rather than as the recipe for the later release line.

What we have not tested yet

Our October source checks and November plain-Node example attempt do not cover a working production application. We have not tested a React migration, browser layout, hydration, automatic ref forwarding, moveBefore behavior, Signals performance, server rendering or the reported packaging and typing workarounds. The sandbox image labels do not establish actual Node or operating-system versions. The original library author's confirmation of the later packaging workaround is absent, and the historical IE excerpts leave their final application outcomes incomplete.

Application download size, startup time, update latency, memory under load and search-ranking effects are unmeasured. The October test result does not certify the separately installed November package. No vulnerability assessment accompanies these measurements. The historical lifecycle and third-party DOM discussions are not acceptance tests for current widgets, and the class-code discussion supplies no measured class-free bundle result. The evidence also does not establish a final Preact 11 legacy-browser support matrix or a common-workload performance winner among the alternatives.

The video results contain no implementation transcripts, and the Reddit threads concern the exam rather than the JavaScript library. They support no developer-satisfaction conclusion. The November 24 X post is an upstream announcement, not our feature validation. Rendered page layout, automatic related links, recommendation modules and template content are outside this text review. Before replacing a runtime, a useful next step is to exercise the application's hardest dependency, server import path and published-package consumer in a branch.

Alternatives

ProjectWhat it isPick it when
React gh↗The library whose imports Preact's migration guide redirects through its compatibility layer.Keep React when your team does not want to maintain the Node, bundler and TypeScript substitutions documented for a Preact migration.
Svelte gh↗A compiler that converts declarative components into JavaScript that updates the DOM.Consider Svelte when you want its component compiler rather than a migration based on redirecting React imports.

Sources

  1. Preact repository and component tutorial
  2. Preact v11 getting started and migration aliases
  3. Vite discussion: published Preact component-library failure
  4. Introducing Signals, by the Preact team
  5. Our October 25 source install, build and tests
  6. Svelte component compiler
  7. Preact custom-element type discussion

More web reviews