ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
? Reminder: This module is for Preact 8.x and prior - Preact X includes compat by default. For Preact X, please uninstall
preact-compat
and replace your aliases withpreact/compat
.
createContext()
, courtesy of preact-context (#529, thanks @probablyup!)Reminder: preact-compat
should never be used with Preact X.
preact-compat
should never be used with Preact X. Doing so will have unintended consequences including the pollution of Object.prototype
(example).
This release of preact-compat changes peerDependencies
to warn when installing alongside Preact 10+. You can (and should) continue to use preact-compat
in conjunction with Preact 8 and prior.
If you're having trouble finding references to preact-compat
in your codebase, try using a Webpack alias:
resolve: {
alias: {
'preact-compat': 'preact/compat'
}
}
createRef()
(added in Preact 8.4)hydrate()
aliasprocess={}
(#504, thanks @marvinhagemeister!)Quick bugfix: findDOMNode()
should return an element if given one (#493, #495 - thanks @billneff79 & @zhaopeifei)
createPortal()
(#452, #486)process
shim in bundlers (#403, #472 - thanks @kaisermann)3.18.2 fixes an HTML injection vulnerability (CVE-2018-6341), so we encourage everyone to update.
The fix is contained in [email protected], used by preact-compat/server
.
See React's detailed notes for more information. Thanks for @gaearon and the React team for the coordinated fix!
react-dom-factories
(#456, thanks @freeman)getDefaultProps
on the class so static properties are available (#421, @joeyrobert)props.children
issue (#415, thanks @kozak)Symbol.for()
(#423, @xxxiin)renderSubtreeIntoContainer()
to match React (#399, @lsroman)Children.toArray()
always return a new array (#395, @ustccjw)props.className
is now an alias of props.class
(#412)vectorEffect
to the list of camel case properties (#409, @icewind1991)React.__spread
export since it's already available (#407, @gnarf)PureComponent
prototype now includes isPureReactComponent: true
lib/update
(#260, #339 - thanks @slaskis!)Children.toArray
when passed undefined (#341 - thanks @AlexanderOtavka!)prop-types
package (#359, #362 - thanks @conceptualitis, @DonnieWest, @tkh44)3.14.2
(#332, thanks @0xR!)children
could be mutated across VNodes (#330, thanks @conorhastings!)