update the dioxus cratesio readme, add many more examples (#5501)
* update the dioxus cratesio readme * fix example * fix header * add a bunch more examples
This commit is contained in:
1 parent
74e7d20f80
commit
cd54f5953b
30 files changed
+1403
-235
No files matched your search
@@ -0,0 +1,27 @@
|
||||
//! Setting the page title.
|
||||
//!
|
||||
//! The `Title` component renders a `<title>` tag into the document head. On the web it
|
||||
//! sets the browser tab title; on desktop it becomes the window title. Because it's a
|
||||
//! regular component, its contents can be driven by signals and update live.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(app);
|
||||
}
|
||||
|
||||
fn app() -> Element {
|
||||
let mut unread = use_signal(|| 0);
|
||||
|
||||
rsx! {
|
||||
// The title updates every time the signal changes
|
||||
Title {
|
||||
if unread() > 0 { "({unread}) Inbox" } else { "Inbox" }
|
||||
}
|
||||
|
||||
h1 { "Inbox" }
|
||||
p { "Unread messages: {unread}" }
|
||||
button { onclick: move |_| unread += 1, "New message" }
|
||||
button { onclick: move |_| unread.set(0), "Mark all read" }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user