family.rs 589 B

123456789101112131415161718192021222324252627282930313233
  1. use std::collections::HashMap;
  2. use dioxus_core::prelude::*;
  3. use recoil::*;
  4. const TODOS: AtomFamily<&str, Todo> = |_| HashMap::new();
  5. #[derive(PartialEq)]
  6. struct Todo {
  7. checked: bool,
  8. contents: String,
  9. }
  10. static App: FC<()> = |ctx, _| {
  11. rsx! { in ctx,
  12. div {
  13. "Basic Todolist with AtomFamilies in Recoil.rs"
  14. }
  15. }
  16. };
  17. static Child: FC<()> = |ctx, _| {
  18. // let todo = use_recoil_value(ctx, &TODOS);
  19. rsx! { in ctx,
  20. div {
  21. }
  22. }
  23. };
  24. fn main() {
  25. wasm_bindgen_futures::spawn_local(dioxus_web::WebsysRenderer::start(App))
  26. }