alternative.rs 760 B

123456789101112131415161718192021222324252627
  1. fn main() {}
  2. use dioxus_core::prelude::*;
  3. static Example: FC<()> = |ctx| {
  4. ctx.render(dioxus_core::prelude::LazyNodes::new(move |ctx| {
  5. let bump = ctx.bump();
  6. dioxus_core::builder::ElementBuilder::new(ctx, "h1")
  7. .children([dioxus_core::builder::text3(bump, format_args!("hello"))])
  8. .finish()
  9. }))
  10. };
  11. struct Props {
  12. text: String,
  13. }
  14. static Example2: FC<Props> = |ctx| {
  15. ctx.render(dioxus_core::prelude::LazyNodes::new(move |__ctx| {
  16. let bump = __ctx.bump();
  17. dioxus_core::builder::ElementBuilder::new(__ctx, "h1")
  18. .children([dioxus_core::builder::text3(
  19. bump,
  20. format_args!("{}", ctx.props.text),
  21. )])
  22. .finish()
  23. }))
  24. };