Fix error in examples/future.rs comments, use_futures inline docs comments, also added clarification that Signal<T>.read() and Singal<T>() are the same thing

This commit is contained in:
andrey committed 2024-02-28 11:42:04 +08:00
1 parent 5a73147d69
commit 70136b22ea
11 files changed
+164 -5

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
//! A simple example that shows how to use the use_future hook to run a background task.
//!
//! use_future assumes your future will never complete - it won't return a value.
//! If you want to return a value, use use_resource instead.
//! use_future won't return a value, analagous to use_effect.
//! If you want to return a value from a future, use use_resource instead.
use dioxus::prelude::*;
use std::time::Duration;
+22
View File
@@ -0,0 +1,22 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}
+22
View File
@@ -0,0 +1,22 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}
+25
View File
@@ -0,0 +1,25 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
let counter = use_signal(|| 0usize);
rsx! {
button { onclick: move || counter += 1, "Increment Counter" }
p { "{counter}" }
}
}
+22
View File
@@ -0,0 +1,22 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}
+22
View File
@@ -0,0 +1,22 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}
@@ -0,0 +1,22 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}
+22
View File
@@ -0,0 +1,22 @@
//! The simplest example of a Dioxus app.
//!
//! In this example we:
//! - import a number of important items from the prelude (launch, Element, rsx, div, etc.)
//! - define a main function that calls the launch function with our app function
//! - define an app function that returns a div element with the text "Hello, world!"
//!
//! The `launch` function is the entry point for all Dioxus apps. It takes a function that returns an Element. This function
//! calls "launch" on the currently-configured renderer you have. So if the `web` feature is enabled, it will launch a web
//! app, and if the `desktop` feature is enabled, it will launch a desktop app.
use dioxus::prelude::*;
fn main() {
launch(app);
}
fn app() -> Element {
rsx! {
div { "Hello, world!" }
}
}