From 0.18.0 to 0.19.0

    Instead only the most impactful changes are mentioned and the rest should be picked up by cargo.

    The syntax of the html! macro has been updated, such that in most cases you will need to enclose props with braces.

    • Invalid
    • Valid
    • Shorthand

    Shorthand initialization has been added:

    There is a community provided regex to help automate the update, though we can’t promise it will work all the time.

    It breaks when it encounters closures (specifically the |_| syntax).

    replace with ={$1}

    Function components

    Function components are a brand new way to write components that requires less boilerplate than their structural counterpart.

    While this change does not force you to change your codebase, as you migrate from 0.18 to 0.19, this migration time might present a good opportunity to start using them in your codebase.

    Struct components also received changes to their API.

    removed in favor of bool and can be just find all - replaced throughout your code base.

    You will need to remove link and props from your component struct fields as such all lifetime methods got updated.

    For new API look in the Component trait

    web-sys is no longer re-exported

    Add web-sys as your project dependency and one by one add the needed features like Event or Window.

    During this update all services were removed in favor of community driven solutions like

    Remove this entirely. adds a layer a abstraction which makes it easier to call external resources. This is all well and good but this layer is supposed to be specific to Yew. It would be better if an framework agnostic abstraction existed instead.

    • DialogService Use gloo-dialogs instead.
    • IntervalService Use instead.
    • KeyboardService``on* event handlers in yew already handle it. Using this service is even more cumbersome because it requires use of NodeRef in order to call any functions provided by it.
    • ResizeService Use gloo-events to attach the listener instead.
    • StorageService Use instead.
    • TimeoutService Use gloo-timers instead.
    • FetchService Use or gloo-net instead.

    New crate - yew-agent

    We are sorry if some things are not covered in this guide as it was truly a huge update and we hope that the uncovered issues will be clearly explained in error messages emitted by the Rust compiler.