Migration Guide: v0.9 to v0.10
Warning: v0.10 is still currently in active development. Any content below is a work in progress and not finalised yet.
Event handlers are now normal methods
Instead of the bespoke on:event=... syntax for event handlers, all events should be attached using on_event=... syntax.
For example:
// Old
view! {
div(on:click=|| { ... })
}
// New
view! {
div(on_click=|| { ... })
}
This change also makes the builder API slightly simpler to use.
// Old
div().on(event::click, || { ... })
// New
div().on_click(|| { ... })
Components automatically return builders
The #[component] function now transforms component functions to return a fluent-style builder instead of just the raw component function. For users of the view! macro, this shouldn’t change anything but for builder API users, this makes components much nicer to use.
#[component]
fn Foo(bar: i32) -> View {
view! { ... }
}
// Old
div().children(
Foo(FooProps::builder().bar(123).build())
)
// New
div().children(
Foo().bar(i32)
)
This makes components share essentially the same syntax as elements.