Fragments
The html! macro always requires a single root node. In order to get around this restriction, you can use an “empty tag” (these are also called “fragments”).
- Valid
- Invalid
use yew::prelude::*;html! {<><div></div><p></p></>};
use yew::prelude::*;// error: only one root html element allowedhtml! {<div></div><p></p>};