Version: Next

Fragments

The html! macro always requires a single root node. To get around this restriction, you can use an "empty tag" (these are also called "fragments").

use yew::prelude::*;

html! {
    <>
        <div></div>
        <p></p>
    </>
};
use yew::prelude::*;

// error: only one root html element allowed

html! {
    <div></div>
    <p></p>
};