remove cx.render

This commit is contained in:
Jonathan Kelley committed 2024-01-13 21:12:21 -08:00
1 parent fae0b08e61
commit 1dde044697
159 files changed
+600 -658

No files matched your search

@@ -75,10 +75,10 @@ fn main() {
}
//
fn app() -> Element {
let user_name = use_state(|| "?".to_string());
let permissions = use_state(|| "?".to_string());
let user_name = use_signal(|| "?".to_string());
let permissions = use_signal(|| "?".to_string());
cx.render(rsx! {
rsx! {
div {
button {
onclick: move |_| {
@@ -117,7 +117,7 @@ fn app() -> Element {
}
"Permissions: {permissions}"
}
})
}
}
#[server(GetUserName)]
@@ -3,10 +3,10 @@ use dioxus::prelude::*;
use dioxus_fullstack::prelude::*;
pub fn app() -> Element {
let mut count = use_state(|| 0);
let text = use_state(|| "...".to_string());
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
cx.render(rsx! {
rsx! {
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
@@ -24,7 +24,7 @@ pub fn app() -> Element {
"Run a server function"
}
"Server said: {text}"
})
}
}
#[server(PostServerData)]
@@ -22,11 +22,11 @@ fn app(cx: Scope<AppProps>) -> Element {
let state =
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_state(|| 0);
let text = use_state(|| "...".to_string());
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
let eval = use_eval(cx);
cx.render(rsx! {
rsx! {
div { "Server state: {state}" }
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
@@ -45,7 +45,7 @@ fn app(cx: Scope<AppProps>) -> Element {
"Run a server function!"
}
"Server said: {text}"
})
}
}
#[server]
@@ -51,10 +51,10 @@ fn Blog(id: i32) -> Element {
#[component]
fn Home() -> Element {
let mut count = use_state(|| 0);
let text = use_state(|| "...".to_string());
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
cx.render(rsx! {
rsx! {
Link {
to: Route::Blog {
id: *count.get()
@@ -80,7 +80,7 @@ fn Home() -> Element {
}
"Server said: {text}"
}
})
}
}
#[server(PostServerData)]
@@ -19,10 +19,10 @@ fn app(cx: Scope<AppProps>) -> Element {
let state =
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_state(|| 0);
let text = use_state(|| "...".to_string());
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
cx.render(rsx! {
rsx! {
div {
"Server state: {state}"
}
@@ -43,7 +43,7 @@ fn app(cx: Scope<AppProps>) -> Element {
"Run a server function!"
}
"Server said: {text}"
})
}
}
#[server(PostServerData)]
@@ -69,10 +69,10 @@ fn Blog() -> Element {
#[component]
fn Home() -> Element {
let mut count = use_state(|| 0);
let text = use_state(|| "...".to_string());
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
cx.render(rsx! {
rsx! {
Link {
to: Route::Blog {},
"Go to blog"
@@ -82,5 +82,5 @@ fn Home() -> Element {
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
}
})
}
}
@@ -19,10 +19,10 @@ fn app(cx: Scope<AppProps>) -> Element {
let state =
use_server_future((), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_state(|| 0);
let text = use_state(|| "...".to_string());
let mut count = use_signal(|| 0);
let text = use_signal(|| "...".to_string());
cx.render(rsx! {
rsx! {
div {
"Server state: {state}"
}
@@ -43,7 +43,7 @@ fn app(cx: Scope<AppProps>) -> Element {
"Run a server function!"
}
"Server said: {text}"
})
}
}
#[server(PostServerData)]