Yew 0.22 - For Real This Time
The Yew team is thrilled to announce the release of Yew 0.22! After a longer-than-expected journey, this release brings significant improvements to ergonomics, performance, and developer experience.
Highlights#
New #[component] Attribute#
The #[function_component] attribute has been renamed to #[component] for brevity:
// Before
// After (0.22+)
The old #[function_component] attribute is deprecated but still works, giving you time to migrate.
For-Loops in html!#
You can now use for-loops directly in the html! macro, making iteration more natural:
// Before - using iterator adapters
html!
// After (0.22+) - native for-loop syntax
html!
MSRV Raised to 1.84.0#
The minimum supported Rust version is now 1.84.0. This allows us to use newer language features and provide better error messages.
WASI Support for SSR#
Server-side rendering now works on WASI targets. See the original 0.22 announcement for details.
Better Cloning Ergonomics#
ImplicitCloneis implemented for more yew types. This means less&and*and.clone()clutter in the html macro.
yew-agent: Vendored gloo-workers#
The yew-agent crate now includes its own web worker implementation, removing the external dependency on gloo-worker. This also adds support for module-type web workers:
let spawner = new
.as_module // Use ES module workers
.spawn;
yew-router: Query Parameter Traits#
The FromQuery and ToQuery traits from gloo are now re-exported via yew_router::query for more flexible query parameter handling, along with dynamic basename support.
Migration Guide#
See the migration guide for detailed instructions on upgrading from 0.21.
Contributors#
Many thanks to everyone who contributed to this release! Special thanks to:
- @WorldSEnder for hydration fixes
- @its-the-shrimp for html macro enhancements
- @Kirill Semyonkin for implicit clone library improvements
- @langyo for WASI SSR support
- @cecton for implicit clone improvements and ergonomics
- @ranile for property improvements
And all the other contributors who helped make this release possible!
What's Next#
We're continuing to work on improving Yew's performance, developer experience, and documentation. Join us on Discord to get involved!
See the full changelog for all changes.