NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1799 most downloaded on npm
Fast 3kb React-compatible Virtual DOM library.
Last release 9 days ago
08 Sep 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
286 releases · first in 2015
Fix IE issues from 7.1 and update test cases (huge thanks to @mkxml for the hard work on this 🙇)
npm install --save preact
dangerouslySetInnerHTML to children (thanks @harish2704)<select> sometimes not applying value prop (#446)true children, instead skip them (#468, thanks @jxodwyer)props.children when there are no children. Fixes simple shallow equality-based shouldComponentUpdate for leaf nodes 🎉instanceof SVGElement check in favor of duck typing. Fixes JSDOM compatibility and improves diff performance (#423, thanks @nhunzaker)10x performance boost for initial rendering
One column per quarter.
This release fixes an issue when hydrating from a static server-rendered DOM that could cause Preact to do far more work than it should have been doin
This release fixes an issue when hydrating from a static server-rendered DOM that could cause Preact to do far more work than it should have been doing. If you're doing SSR, check out this release for a massive performance boost.
7.x is currently in beta. It should be an entirely safe upgrade for most.
7.x is currently in beta. It should be an entirely safe upgrade for most.
The reason it's a new major version is because Preact now ignores externally created DOM elements when rendering, unless performing hydration from a server-render (ie - the diff is initiated from a render() against an element that was not created by the DOM renderer).
Nothing published for this version
Preliminary React DevTools support thanks to the amazing @robertknight! 🙇
<img width="353" src="https://cloud.githubusercontent.com/assets/105127/19808223/ca9c16ca-9cf1-11e6-833d-94d8a2841a8f.gif">
With 6.3.0, the children prop (on a VNode) is now _always_ an Array, even if there are no children. This allows us to skip an existence check when plu
With 6.3.0, the children prop (on a VNode) is now always an Array, even if there are no children. This allows us to skip an existence check when plucking children within render:
// 6.2.1 & prior:
({ children }) => children && children[0];
// As of 6.3.0:
({ children }) => children[0];
This change is backwards compatible since previously an empty array was already being returned for no children in some cases. Now it's just more consistent! 🌈
Bugfix: Switch to using the render parent to determine if re-rendering starting from within an SVG, since the current element may not exist (eg: for a
Bugfix: Switch to using the render parent to determine if re-rendering starting from within an SVG, since the current element may not exist (eg: for a component).
Support for infinitely nested children!
children!h() (the hyperscript/jsx processor/reviver).aliases.js and typings.json to the NPM package.Component._disableRendering to Component._disable to save a few bytesgetInitialState() on classful components.This has never been part of the API but was left in core in order to support
preact-compat's use. It is now being moved intopreact-compat. This allows preact to normalize class components that don't inherit from Component.
6.1.0 where state changes in componentDidUpdate() resulted in synchronous re-rendersclassName prop (alias) would incorrectly assign className as an attribute. /cc @pl12133class for SVG (test included) (#334)Don't skip empty values in extend() (and thus in setState()). Fixes #308.
extend() (and thus in setState()). Fixes #308.value and checked props. Fixes #326.package.json. Fixes #318.className to class normalization and hashed class stringification out of h() and into the DOM renderer.
className and expecting them to have attributes.class instead of attributes.className, that is no longer the case.Fix when datalist element is placed after the input in the DOM (Issue #294, thanks @vutran!)
<input list="id"> when datalist element is placed after the input in the DOM (Issue #294, thanks @vutran!)Make 6.x the official latest release!
_While this is technically a breaking change, very few people use this API_
npm install --save preact@beta
<foreignObject> (#278, thanks @amio!)preact/aliases import: A copy of preact that includes a createElement() alias (#168/#274, thanks @ngasull!)keyed nodes when diffing children instead of allowing them to be reused unkeyedlinkState() no longer falls back to components path lookups and no longer auto-invokes functions
options.vnode hook
5.7 that could cause nodes to be removed (related to #260/#277)on prefix for event handler props (#275, thanks @c2h5oh!)Correct regression introduced in 5.6.0 where re-rendering components with the same root node could duplicate their DOM. Fixes #257.
5.6.0 where re-rendering components with the same root node could duplicate their DOM. Fixes #257.this.props and this.context, even when a class improperly inherits from Component (eg: calls super() without forwarding arguments)"", null, etc) rendering a comment - this should only occur when an empty vnode is returned from a component's render().When rendering null, a comment node will be inserted instead of an empty TextNode.
null, a comment node will be inserted instead of an empty TextNode.linkState() with components instead of DOM elements, use the first argument passed to the event handler as the default value unless a path is given.nodeValue property of a TextNode that has been removed from the DOM.Fix this.base not being unset when unmounting High-Order components
this.base not being unset when unmounting High-Order components (#239)Nothing published for this version
Disable rendering on unmount (thanks @Madumo!) [discussion]
Fix keyed node removal issue noted by @localvoid and originally noticed by @kruczy in #235.
Fix for erroneously recycled components
Version 5 represents a fairly major jump forward. It should be backwards-compatible, but major version increment is to signify a few new features that
Version 5 represents a fairly major jump forward. It should be backwards-compatible, but major version increment is to signify a few new features that will not be made available in older versions - mainly built-in SVG support, and async rendering.
Take a few seconds and upgrade, you'll be happy you did! 🌈
Tip: If you're using preact-compat, it's best to upgrade that to
2.0.0at the same time. Since Preact 5+ now includes built-in support for SVG,preact-compat@2drops thepreact-svgdependency, saving you around1.7kb.
Along with the lovely stable stamp, this release includes some finishing touches:
ref may be nulled before a component is unmounted (#232, thanks @slmgc!)Style objects now have a lightning fast pipeline out to the DOM. (#228, thanks @trashhalo!)
Example:
<div style={{ foo:'bar '}} />now diffs against the current style rather than stringifying the object
Fixed lifecycle event DOM timing! #65 and #96
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
### Features - #220 - Add Flow definition (fixes #219) - thanks @bouk!
### Bug Fixes - #218 - Fix nested JSX text children resulting in multiple TextNodes (thanks @bardt!)
Fix an inconsistency with how defaultProps are applied (developit/preact-compat#47)
Fix an inconsistency with how defaultProps are applied (developit/preact-compat#47)
A key in
propswith a value ofundefinedshould be treated as a missing key, and the value fromdefaultPropsshould be used in its place.
Switch setImmediate backend from MessageChannel to Promise#then (change diff)
This is much faster!
However: This comes with the caveat of being unusable for animation. While this matches the use-case for
setImmediate()within Preact (debouncing rendering), it means thatcomponentDidUpdate()andsetState()callbacks should not be used as a means of animation. ** This is only true when using the built-in debounce mechanism. Overriding to requestAnimationFrame is still a great way to do animations via these hooks.
Fix an issue where swapping between functional and classful children of a high-order component could trigger an unmount in certain cases
Fix an issue where swapping between functional and classful children of a high-order component could trigger an unmount in certain cases
💁 If you're using preact-router, this fixes a redirect breakage
- #207 Fix xlinkHref prop for tags - thanks @aeosynth!
xlinkHref prop for <svg> tags - thanks @aeosynth!Ignore props.children if children are manually specified (as jsx children, or the third argument to h())
props.children if children are manually specified (as jsx children, or the third argument to h())<svg class> bug @zhenkunou found and reported in #202Fix and (corrected) test for object style attribute serialization (#204) - thanks @katopz
Fix issue where value and a few other properties could get out of sync with their DOM counterparts.
value and a few other properties could get out of sync with their DOM counterparts.5.0.1-beta.14. The codemod is now more intelligent and will only remove pointless initialization to undefined if not done within a conditionally executable block.Fixes 5.0.1-beta.13 having been published without the beta flag.
5.0.1-beta.13 having been published without the beta flag.Bugfix: When recycling old trees due to a Component render producing a different root node, avoid accidentally recycling the base of a high-order chil
base of a high-order child component.Allow functions as VNode children
This is used in libraries that provide animation functionality by re-rendering function children with changing props:
render() { return ( <SomeAnimator start={0} end={155} loop> { hue => ( <span style={{ color: `hsl(${hue}, 100%, 60%)` }}>Rainbow</span> ) } </SomeAnimator> ); }
Account for High-Order stateful child components wrapped in one or more functional components
Add support for cloneElement(). See React's Docs for more.
cloneElement(). See React's Docs for more.try{} block, as it can throw.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Switch to exclusively named exports. Fixes compatibility with ES Module bundlers like Rollup (#150).
shouldComponentUpdate() when updating via forceUpdate() (#158)Fix issue where switching HOC child components could trigger unmount lifecycle methods on the parent
Fix issue where Components rendering null would break functional root check introduced in 5.0.0-beta9
null would break functional root check introduced in 5.0.0-beta9 (#182)null/undefined value when using className compat alias (#181)DOM event handlers are no longer invoked with the source element as their context (this)
this) (#153)0 values (#149)key property to VNodes (#155)Preact 4: <img src="http://i.imgur.com/PPswLY8.png" width="400" />
Preact 5: <img src="http://i.imgur.com/Fd8mmxT.png" width="400" />
Fix children being ignored when passed explicitly via props in certain cases. Fixes developit/preact-compat#44 (thanks @ld0rman!)
Fix children being ignored when passed explicitly via props in certain cases. Fixes developit/preact-compat#44 (thanks @ld0rman!)
Fun fact: this means you can now do:
<div children={['hello!']} />
Bugfix: Fixes an issue caught by preact-compat's ref tests, where swapping the root node rendered by a component would null its ref twice.
Fix regression in 4.6.2 related to recycled component DOM not being treated as first render
Merge #106: removes some unnecessary code, drops ~50 bytes
Merge #106: removes some unnecessary code, drops ~50 bytes
Lazy-instantiate the internal mapping for linkState() and setState's callback queue.
This reduces allocation cost for components. It also reduces overall memory consumption for classful components that don't make use of those given features (certainly the common case for
setStatecallback)
Don't attempt to append a child to a parentNode if the child _is_ the parentNode. Fixes Issue #126.
Optimize serialization of Objects to CSS strings to be about 5x faster (benchmark: https://esbench.com/bench/570daee0db965b9a009659f7)
Optimize serialization of Objects to CSS strings to be about 5x faster (benchmark: https://esbench.com/bench/570daee0db965b9a009659f7)
Rethink solution to #120. TL;DR: fresh instances, cached DOM. Long version:
Re-invoking the constructor on a class was not a great idea. Babel's transpiled constructors (and basically anything else) re-assign to the prototype, which is slow and a fairly bad idea. Also, and more importantly, it was assigning
this.basetonull, completely ignoring the main reason for caching components (caching their generated DOM using the component itself as a cache key). This commit changes the behavior to discard the cached component instance itself, re-using only the base by copying it to a fresh instance. Best of both worlds!
Fix for #122: don't assume Function.prototype exists, as it does not for Arrow Functions (thanks @LinusU!)
Fix regression since 4.5.0 where key tracking for components would fail in some cases, causing components not to be recycled. Relates to #98 and the s
4.5.0 where key tracking for components would fail in some cases, causing components not to be recycled. Relates to #98 and the second issue noted in #120.Symbol.for('preactattr') for the prop cache key (still falling back to __preactattr_).Updated ESLint, announced preactjs.com website.
Fix context being null/undefined when unset. It should be an empty object.
ref (and key) were not being removed from props prior to being passed into component render (Issue #98)uglify-js without name mangling and with beautification (removes comments and applies dead code elimination)When reclaiming externally created elements _(such as via dangerouslySetInnerHTML)_, copy their attributes into the prop cache so they are properly di
dangerouslySetInnerHTML), copy their attributes into the prop cache so they are properly diffed on subsequent render (Issue #97)Fix exception thrown when removing/unsetting dangerouslySetInnerHTML
dangerouslySetInnerHTMLFixed issue where setting the value prop for a element could have no effect on initial render
value prop for a <select> element could have no effect on initial renderYour coding agent can read these notes before it upgrades. Set up the MCP server →