Crates.io | silkenweb-reactive |
lib.rs | silkenweb-reactive |
version | 0.1.2 |
source | src |
created_at | 2021-04-29 10:48:28.873503 |
updated_at | 2023-01-07 00:36:12.540629 |
description | Silkenweb reactive primitives |
homepage | https://github.com/silkenweb/silkenweb |
repository | https://github.com/silkenweb/silkenweb |
max_upload_size | |
id | 390982 |
size | 26,071 |
This is an old implementation crate for Silkenweb that is no longer used.
A library for building reactive single page web apps.
input().dom_element()
returns a web_sys::HtmlInputElement
button().on_click(...)
passes your event handler a web_sys::HtmlInputElement
and a web_sys::MouseEvent
.use silkenweb::{
elements::{button, div, p},
mount,
signal::Signal,
};
fn main() {
let count = Signal::new(0);
let set_count = count.write();
let inc = move |_, _| set_count.replace(|&i| i + 1);
let count_text = count.read().map(|i| format!("{}", i));
let app = div()
.child(button().on_click(inc).text("+"))
.child(p().text(count_text));
mount("app", app);
}
rustup target add wasm32-unknown-unknown
cargo install trunk wasm-pack
cargo install wasm-bindgen-cli --version 0.2.73
cd examples/counter
trunk serve --open