Crate concoct

source ·
Expand description

A UI framework for writing declarative apps on multiple platforms.

Concoct uses static typing to describe your UI at compile-time to create an efficient tree of components. Updates to state re-render your application top-down, starting at the state’s parent component.

use concoct::{View, ViewBuilder};
use concoct::hook::use_state;
use concoct_web::html;

struct App;

impl ViewBuilder for App {
    fn build(&self) -> impl View {
        let (count, set_high) = use_state(|| 0);
        let set_low = set_high.clone();

        (
            format!("High five count: {}", count),
            html::button("Up high!").on_click(move |_| set_high(count + 1)),
            html::button("Down low!").on_click(move |_| set_low(count - 1)),
        )
    }
}

Feature flags

  • full: Enables all of the features below.
  • tracing: Enables logging with the tracing crate.

Re-exports

  • pub use self::view::View;

Modules

  • Hooks to access render context.
  • Viewable components of a user-interface.

Structs

Traits

Functions

  • Run a view in a new virtual dom.