mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-12-18 08:33:07 +00:00
34 lines
645 B
Rust
34 lines
645 B
Rust
//! An example that shows how to:
|
|
//! create a scope,
|
|
//! render a component,
|
|
//! change some data
|
|
//! render it again
|
|
//! consume the diffs and write that to a renderer
|
|
|
|
use dioxus_core::{prelude::*, scope::Scope};
|
|
|
|
fn main() -> Result<(), ()> {
|
|
let p1 = Props { name: "bob".into() };
|
|
|
|
let mut vdom = VirtualDom::new_with_props(Example, p1);
|
|
vdom.progress()?;
|
|
|
|
Ok(())
|
|
}
|
|
|
|
struct Props {
|
|
name: String,
|
|
}
|
|
impl Properties for Props {
|
|
fn new() -> Self {
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
static Example: FC<Props> = |ctx, props| {
|
|
ctx.view(html! {
|
|
<div>
|
|
<h1> </h1>
|
|
</div>
|
|
})
|
|
};
|