This release represents a huge step forward for Preact:
- Significantly increased performance - in some cases by 30%.
- Better compatibility -
classintegrations, capturing events.
- Fewer edge cases - goodbye to unnecessary mounts and DOM hierarchy errors.
- Even smaller - Preact had been 3.9kb for a while - now it's 3.3kb (and headed for 2.9kb!)
💁If you're looking to upgrade, be sure to read the quick guide.
- Pure Functional Components now have backing instances. This means
keynow works perfectly on PFC's. It also means you could use state and lifecycle methods in Functional Components... (#163, #517, #536, #586, #474)
linkState()has been removed from Preact itself. It is being published as a standalone linkstate module shortly.
classNameno longer serialize Object values to Strings. Instead, use classnames (#401)
preact/aliasesis no longer necessary.
createElement()is now an alias of
h()right out of the box!
- DOM element recycling has been removed. It was a source of issues for many, and is no longer necessary for great performance thanks to diff optimizations that reduce the number of cases where elements are removed and re-added. (#544, #351, #461, #459, #503, #535, #562)
- Undefined components references now throw rather than rendering
- No more
Symbol. Instead of try to use
__preactattr_is always used.
- Render debouncing now uses
setTimeout(0)instead of Promises. It's smaller, doesn't swallow rendering errors in Safari, and was already the fallback (#357)
- The non-standard
componentDidUnmount()lifecycle method is removed. Use
onXxxxCaptureis now supported for registering capturing event handlers.
- Events like
blurare no longer automatically capturing by default.
- Hierarchy errors are a thing of the past (thanks to recycler and PFC rewrites) (#380, #391)
- Fixed edge case that could cause children to be rendered out of order (#581, #603)
- Unmount lifecycle is always fired when replacing a Component with an empty element (#538, #534)
reffunctions attached to DOM nodes are no longer invoked for updates, only for mount/unmount.
Other Notable Changes
- "holes" in JSX children are now preserved and used intelligently by the diff (#580, #540)
- Re-rendering a compositional child with a different
keyprop now triggers a remount (#338)
- JSX children passed to a Component are preserved rather than normalized (#551)
- Preact no longer relies on the
Arrayconstructors for type checks, instead relying on duck typing (#595, #530)
- Ignore whitespace-only Text nodes during SSR hydration. SSR boot is now significantly faster than cold boot.
Here's the list of changes itemized by commit: