---
title: Yew 0.22 - For Real This Time
authors: [mattuwu]
---

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.

<!--truncate-->

## Highlights

### New `#[component]` Attribute

The `#[function_component]` attribute has been renamed to `#[component]` for brevity:

```rust
// Before
#[function_component]
fn MyComponent() -> Html {
    html! { <div>{"Hello!"}</div> }
}

// After (0.22+)
#[component]
fn MyComponent() -> Html {
    html! { <div>{"Hello!"}</div> }
}
```

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:

```rust
// Before - using iterator adapters
html! {
    <ul>
        { for items.iter().map(|item| html! { <li>{ item }</li> }) }
    </ul>
}

// After (0.22+) - native for-loop syntax
html! {
    <ul>
        for item in items {
            <li>{ item }</li>
        }
    </ul>
}
```

### 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](/blog/2024/10/14/release-0-22) for details.

### Better Cloning Ergonomics

- `ImplicitClone` is 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**:

```rust
let spawner = WorkerSpawner::<MyWorker>::new()
    .as_module(true)  // 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](/docs/migration-guides/yew/from-0_21_0-to-0_22_0) for detailed instructions on upgrading from 0.21.

## Contributors

Many thanks to everyone who contributed to this release! Special thanks to:

- [@WorldSEnder](https://github.com/WorldSEnder) for hydration fixes
- [@its-the-shrimp](https://github.com/its-the-shrimp) for html macro enhancements
- [@Kirill Semyonkin](https://github.com/kirillsemyonkin) for implicit clone library improvements
- [@langyo](https://github.com/langyo) for WASI SSR support
- [@cecton](https://github.com/cecton) for implicit clone improvements and ergonomics
- [@ranile](https://github.com/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](https://discord.gg/VQck8X4) to get involved!

See the [full changelog](https://github.com/yewstack/yew/blob/master/CHANGELOG.md) for all changes.
