dioxus/packages/core/examples/contextapi.rs

41 lines
1.1 KiB
Rust
Raw Normal View History

use dioxus_core::prelude::*;
fn main() {}
struct SomeContext {
items: Vec<String>,
}
struct Props {
name: String,
}
#[allow(unused)]
static Example: FC<Props> = |cpt| {
2021-05-18 05:16:43 +00:00
todo!()
2021-05-18 05:16:43 +00:00
// let value = ctx.use_context(|c: &SomeContext| c.items.last().unwrap());
2021-05-18 05:16:43 +00:00
// ctx.render(LazyNodes::new(move |bump| {
// builder::ElementBuilder::new(bump, "button")
// .on("click", move |_| {
// println!("Value is {}", ctx.name);
2021-05-18 05:16:43 +00:00
// println!("Value is {}", value.as_str());
// println!("Value is {}", *value);
// })
// .on("click", move |_| {
// println!("Value is {}", ctx.name);
2021-05-18 05:16:43 +00:00
// })
// .finish()
// }))
2021-03-01 02:21:17 +00:00
// ctx.render(html! {
// <div>
// <button onclick={move |_| println!("Value is {}", value)} />
// <button onclick={move |_| println!("Value is {}", value)} />
// <button onclick={move |_| println!("Value is {}", value)} />
// <div>
// <p> "Value is: {val}" </p>
// </div>
// </div>
// })
};