Expand description
Construct Yew’s Virtual DOM using ergonomic Rust idioms.
The API is based around functions and makes no use of macros, like html!
which allows it to provide great IDE support. IntelliSense is your friend when using this library.
§Usage
use yew::prelude::*;
use yew_vdom_gen::prelude::*;
use gloo_console::log;
struct Component1;
impl Component for Component1 {
fn view(&self, ctx: &Context<Self>) -> Html {
h1("Heading ").into()
}
}
struct Component2;
impl Component for Component2 {
// ...
fn view(&self, ctx: &Context<Self>) -> Html {
fragment()
.component::<Component1>(yew::props!(Component1::Properties {}))
.child(h2("test2"))
.listener(on_click(|_e| log!("test")))
.into()
}
}
Modules§
- elements
- Contains all the HTML elements
- fragment
- Contains the Yew fragment generation code
- functions
- Functions for creating elements.
- listeners
- Event Listeners that can be attached using element’s
listener
method - prelude
- A list of types which are useful for using the library.
Unless you have name conflicts, it is recommended to add
yew_dsl::prelude::*;
import.
Macros§
Structs§
Traits§
Type Aliases§
- Listener
- A listener that can be attached to an element.