10.11.0
10.11.0
New Hook: useId
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)
Fixes
- Fix memory leak by cleaning up
_parent
,_dom
and__hooks
after unmount (#3709, thanks @JoviDeCroock) - Fix case where the
ref
property could be omitted from reused VNodes (#3696, thanks @JoviDeCroock) - Pass
errorInfo
touseErrorBoundary
callback (#3689, thanks @marvinhagemeister) - Fix typescript definition for
class | className
(#3711, thanks @PodaruDragos)
Maintenance
- Fix the mac arm build (#3697, thanks @gengjiawen)
- Fix published JS formats after #3697 (#3702, thanks @rschristian)
- Add todo benchmark and add a proxy package that uses preact/hooks (#3708, thanks @JoviDeCroock)
- Add deprecation notice to
render()
'sreplaceNode
argument (#3700, thanks @rschristian) - Improve types for bare
createElement()
andh()
calls (#3690, thanks @JoviDeCroock) - Add test for useId (#3716, thanks @JoviDeCroock)