From ce50a4ab85bcc3897f56cb6e55e33d48f2c8ed4c Mon Sep 17 00:00:00 2001 From: willem640 Date: Tue, 26 Dec 2023 21:29:57 +0000 Subject: [PATCH] dioxus project template --- .gitignore | 5 +++++ Cargo.toml | 15 +++++++++++++++ src/main.rs | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 Cargo.toml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore index 3ca43ae..193d30e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb + + +# Added by cargo + +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..908b2ff --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "willem-page" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +dioxus = "0.4.3" +dioxus-fullstack = "0.4.3" + +[features] +default = [] +ssr = ["dioxus-fullstack/axum"] +web = ["dioxus-fullstack/web"] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..4b4211f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,17 @@ +use dioxus::prelude::*; +use dioxus_fullstack::prelude::*; + +fn main() { + LaunchBuilder::new(app).launch(); +} + +fn app(cx: Scope) -> Element { + let mut count = use_state(cx, || 0); + + cx.render(rsx! { + h1 { "High-Five counter: {count}" } + button { onclick: move |_| count += 1, "Up high!" } + button { onclick: move |_| count -= 1, "Down low!" } + }) +} +