⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
Today we are announcing a new hook: useId
. This hook creates stable unique identifiers that are consistent between server-side rendering (using preact-render-to-string) and client-side hydration. The useId()
hook is primarily useful for generating identifiers for attributes like aria-labelledby
and <label for="...">
.
To enable useId()
to generate consistent unique identifiers, please ensure you are using preact-render-to-string version 5.2.4 or newer for server-side rendering.
(#3583, thanks @JoviDeCroock)
_parent
, _dom
and __hooks
after unmount (#3709, thanks @JoviDeCroock)ref
property could be omitted from reused VNodes (#3696, thanks @JoviDeCroock)errorInfo
to useErrorBoundary
callback (#3689, thanks @marvinhagemeister)class | className
(#3711, thanks @PodaruDragos)render()
's replaceNode
argument (#3700, thanks @rschristian)createElement()
and h()
calls (#3690, thanks @JoviDeCroock)radix-ui
which enqueues multiple state updates in the same tick (#3645, thanks @JoviDeCroock )useSyncExternalStore
not working with function values (#3633, thanks @marvinhagemeister )esbuild
(#3630, thanks @marvinhagemeister )We changed our debounce of our rendering to setTimeout! Why? We've batched using microtasks for the past few major versions because it benchmarked well. This had a side-effect of flushing batched renders between event handlers, which can cause some strange behavior:
<input
type="checkbox"
onChange={onChange}
checked={true}
onClick={onClick}
/>
An additional benefit of this change is that code causing an infinite rendering loop will no longer result in an unresponsive browser tab. Rendering in a loop is now capped to the browser's maximum timer frequency (~250Hz), which makes it possible to pause and debug the code triggering an accidental loop.
undefined
in useMemo
after skipped render (#3580, thanks @marvinhagemeister)useMemo
return value after skipped render (#3579, thanks @marvinhagemeister)_pendingValue
to mangle.json
(#3575, thanks @marvinhagemeister)