Consecuit
An experimental functional web UI framework that uses the Rust type system for hooks and more.
How is this different from other frameworks?
Other Functional UI Frameworks:
-
Require the developer to follow the Rule of Hooks.
-
Dynamically identify hooks and maintain their states by counting the order in which they are called.
-
Dynamic design:
- Components are dynamically created and mounted as their parents render.
- Components may be mounted or unmounted depending on state.
Consecuit:
-
Automatically enforce the Rule of Hooks using the Rust type system.
-
Statically know every hook call that will happen.
-
Static-first design:
- Components are statically mounted at the start of the app and remain mounted forever by default.
- Mounting/unmounting based on state are considered special cases,
only available through explicitly using
opt_comp
orvec_comps
.
What does it look like?
Take a look at our TodoMVC (and see its source code).
Or if you want something simpler, here is the code for a counter.
use *;
use *;
use *;
There are more counter examples here
(with live demo here),
including one without macro and one with logic extracted into a use_counter
function.
The docs have more info on creating components and hooks.
This crate uses unsafe.
Don't worry. All publicly exposed function is safe.