Concoct is an incremental computation framework for Rust. This library provides a generic diffing engine for user-interfaces and other reactive systems.
This crate is inspired by React, xilem, and dioxus.
async
Concoct is an incremental computation framework for Rust. This library provides a generic diffing engine for user-interfaces and other reactive systems.
This crate is inspired by React, xilem, and dioxus.
fn counter(initial_value: i32) -> impl Composable {
let mut count = use_state(|| initial_value);
// Spawn a task to update the count
use_future(|| async move {
loop {
time::sleep(Duration::from_millis(500)).await;
count += 1;
}
});
dbg!(count);
}
fn app() -> impl Composable {
// Create 2 counters
(|| counter(0), || counter(100))
}
#[tokio::main]
async fn main() {
let mut composition = Composition::new(app);
composition.build();
loop {
composition.rebuild().await;
}
}