wip: more work on updating syntad
This commit is contained in:
1 parent
e45b6e0aa2
commit
47e896038e
27 files changed
+376
-142
No files matched your search
@@ -29,9 +29,9 @@ impl TitleController {
|
||||
|
||||
fn main() {
|
||||
wasm_bindgen_futures::spawn_local(dioxus_web::WebsysRenderer::start(|ctx| {
|
||||
let title = use_read(ctx, &TITLE);
|
||||
let subtitle = use_read(ctx, &SUBTITLE);
|
||||
let controller = use_recoil_api(ctx, TitleController::new);
|
||||
let title = use_read(&ctx, &TITLE);
|
||||
let subtitle = use_read(&ctx, &SUBTITLE);
|
||||
let controller = TitleController::new(use_recoil_api(&ctx));
|
||||
|
||||
rsx! { in ctx,
|
||||
div {
|
||||
|
||||
@@ -21,7 +21,7 @@ fn update_title(api: &RecoilApi) {
|
||||
|
||||
static App: FC<()> = |ctx| {
|
||||
let title = use_read(&ctx, &TITLE);
|
||||
let next_light = use_recoil_api(ctx, |api| move |_| update_title(&api));
|
||||
let next_light = use_recoil_api(&ctx, |api| move |_| update_title(&api));
|
||||
|
||||
rsx! { in ctx,
|
||||
div {
|
||||
|
||||
@@ -14,7 +14,7 @@ struct Todo {
|
||||
|
||||
static App: FC<()> = |ctx| {
|
||||
use_init_recoil_root(ctx, |_| {});
|
||||
let todos = use_read(ctx, &TODOS);
|
||||
let todos = use_read(&ctx, &TODOS);
|
||||
|
||||
rsx! { in ctx,
|
||||
div {
|
||||
|
||||
@@ -6,7 +6,7 @@ const COUNT: Atom<i32> = |_| 0;
|
||||
static App: FC<()> = |ctx| {
|
||||
use_init_recoil_root(ctx, |_| {});
|
||||
|
||||
let (count, set_count) = use_read_write(ctx, &COUNT);
|
||||
let (count, set_count) = use_read_write(&ctx, &COUNT);
|
||||
|
||||
rsx! { in ctx,
|
||||
div {
|
||||
|
||||
@@ -17,12 +17,12 @@ static App: FC<()> = |ctx| {
|
||||
};
|
||||
|
||||
static Banner: FC<()> = |ctx| {
|
||||
let count = use_read(ctx, &C);
|
||||
let count = use_read(&ctx, &C);
|
||||
ctx.render(rsx! { h1 { "Count: {count}" } })
|
||||
};
|
||||
|
||||
static BtnA: FC<()> = |ctx| {
|
||||
let (a, set) = use_read_write(ctx, &A);
|
||||
let (a, set) = use_read_write(&ctx, &A);
|
||||
rsx! { in ctx,
|
||||
div { "a"
|
||||
button { "+", onclick: move |_| set(a + 1) }
|
||||
@@ -32,7 +32,7 @@ static BtnA: FC<()> = |ctx| {
|
||||
};
|
||||
|
||||
static BtnB: FC<()> = |ctx| {
|
||||
let (b, set) = use_read_write(ctx, &B);
|
||||
let (b, set) = use_read_write(&ctx, &B);
|
||||
rsx! { in ctx,
|
||||
div { "b"
|
||||
button { "+", onclick: move |_| set(b + 1) }
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// const Posts: AtomFamily = |family| {
|
||||
// family.on_get(|key| {
|
||||
|
||||
// //
|
||||
// })
|
||||
// };
|
||||
|
||||
fn main() {
|
||||
wasm_bindgen_futures::spawn_local(dioxus_web::WebsysRenderer::start(App))
|
||||
}
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
static App: FC<()> = |ctx| {
|
||||
//
|
||||
|
||||
let title = use_async_atom();
|
||||
let title_card = suspend(&ctx, title, move |val| {
|
||||
//
|
||||
rsx!(in ctx, div {
|
||||
h3 { "{val}" }
|
||||
})
|
||||
});
|
||||
|
||||
// let fut = (use_async_atom(), use_async_atom());
|
||||
// let title_card2 = ctx.suspend(fut, move |(text, text2)| {
|
||||
// ctx.render(rsx!( h3 { "{text}" } ))
|
||||
// });
|
||||
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
{title_card}
|
||||
// {title_card2}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
async fn use_async_atom() -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn suspend<'a, O>(
|
||||
c: &impl Scoped<'a>,
|
||||
f: impl Future<Output = O>,
|
||||
g: impl FnOnce(O) -> VNode<'a> + 'a,
|
||||
) -> VNode<'a> {
|
||||
todo!()
|
||||
}
|
||||
Reference in new issue
Block a user