Fix the router and stub out a number of crates to get compiling

This commit is contained in:
Jonathan Kelley committed 2024-01-13 20:51:37 -08:00
1 parent 4c6e515da4
commit fae0b08e61
226 files changed
+1057 -1482

No files matched your search

+3 -3
View File
@@ -7,16 +7,16 @@ fn main() {
dioxus_desktop::launch(app);
}
fn app(cx: Scope) -> Element {
fn app() -> Element {
// Because signal is never read in this component, this component will not rerun when the signal changes
use_context_provider(cx, || Signal::new(0));
use_context_provider(|| Signal::new(0));
render! {
Child {}
}
}
fn Child(cx: Scope) -> Element {
fn Child() -> Element {
let signal: Signal<i32> = *use_context(cx).unwrap();
// This component does read from the signal, so when the signal changes it will rerun
render! {
+7 -8
View File
@@ -7,21 +7,20 @@ fn main() {
dioxus_desktop::launch(app);
}
fn app(cx: Scope) -> Element {
let signal = use_signal(cx, || 0);
fn app() -> Element {
let signal = use_signal(|| 0);
use_future!(cx, || async move {
use_future!(|| async move {
loop {
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
*signal.write() += 1;
}
});
let local_state = use_state(cx, || 0);
let computed =
use_selector_with_dependencies(cx, (local_state.get(),), move |(local_state,)| {
local_state * 2 + signal.value()
});
let local_state = use_state(|| 0);
let computed = use_selector_with_dependencies((local_state.get(),), move |(local_state,)| {
local_state * 2 + signal.value()
});
println!("Running app");
render! {
+4 -4
View File
@@ -6,9 +6,9 @@ fn main() {
}
#[component]
fn App(cx: Scope) -> Element {
let signal = use_signal(cx, || 0);
let doubled = use_selector(cx, move || signal * 2);
fn App() -> Element {
let signal = use_signal(|| 0);
let doubled = use_selector(move || signal * 2);
render! {
button {
@@ -22,7 +22,7 @@ fn App(cx: Scope) -> Element {
}
#[component]
fn Child(cx: Scope, signal: ReadOnlySignal<usize>) -> Element {
fn Child(signal: ReadOnlySignal<usize>) -> Element {
render! {
"{signal}"
}
@@ -14,12 +14,12 @@ struct ApplicationData {
many_signals: Signal<Vec<Signal<i32>>>,
}
fn use_app_data(cx: Scope) -> ApplicationData {
fn use_app_data() -> ApplicationData {
*use_context(cx).unwrap()
}
fn app(cx: Scope) -> Element {
use_context_provider(cx, ApplicationData::default);
fn app() -> Element {
use_context_provider(ApplicationData::default);
render! {
div { ReadsFirst {} }
@@ -28,7 +28,7 @@ fn app(cx: Scope) -> Element {
}
}
fn ReadsFirst(cx: Scope) -> Element {
fn ReadsFirst() -> Element {
println!("running first");
let data = use_app_data(cx);
@@ -55,7 +55,7 @@ fn ReadsFirst(cx: Scope) -> Element {
}
}
fn ReadsSecond(cx: Scope) -> Element {
fn ReadsSecond() -> Element {
println!("running second");
let data = use_app_data(cx);
@@ -82,7 +82,7 @@ fn ReadsSecond(cx: Scope) -> Element {
}
}
fn ReadsManySignals(cx: Scope) -> Element {
fn ReadsManySignals() -> Element {
println!("running many signals");
let data = use_app_data(cx);