dioxus project template
This commit is contained in:
parent
76607054d8
commit
ce50a4ab85
|
@ -14,3 +14,8 @@ Cargo.lock
|
|||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
|
|
|
@ -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"]
|
|
@ -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!" }
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue