simplify fullstack hello world examples

This commit is contained in:
Evan Almloff 2023-07-19 16:57:43 -07:00
parent 6ade4767e6
commit f55375b8ce
3 changed files with 6 additions and 24 deletions

View file

@ -22,14 +22,8 @@ fn app(cx: Scope<AppProps>) -> Element {
}
fn Child(cx: Scope) -> Element {
let state = use_server_future(cx, (), |()| async move {
loop {
if let Ok(res) = get_server_data().await {
break res;
}
}
})?
.value();
let state =
use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_state(cx, || 0);
let text = use_state(cx, || "...".to_string());

View file

@ -22,14 +22,8 @@ fn app(cx: Scope<AppProps>) -> Element {
}
fn Child(cx: Scope) -> Element {
let state = use_server_future(cx, (), |()| async move {
loop {
if let Ok(res) = get_server_data().await {
break res;
}
}
})?
.value();
let state =
use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_state(cx, || 0);
let text = use_state(cx, || "...".to_string());

View file

@ -22,14 +22,8 @@ fn app(cx: Scope<AppProps>) -> Element {
}
fn Child(cx: Scope) -> Element {
let state = use_server_future(cx, (), |()| async move {
loop {
if let Ok(res) = get_server_data().await {
break res;
}
}
})?
.value();
let state =
use_server_future(cx, (), |()| async move { get_server_data().await.unwrap() })?.value();
let mut count = use_state(cx, || 0);
let text = use_state(cx, || "...".to_string());