Crates.io | natrix |
lib.rs | natrix |
version | 1.0.0 |
created_at | 2025-03-02 19:32:25.598366+00 |
updated_at | 2025-04-14 10:16:55.155286+00 |
description | Rust-First frontend framework. |
homepage | |
repository | https://github.com/vivax3794/natrix |
max_upload_size | |
id | 1574810 |
size | 156,681 |
Natrix is a Rust-first frontend framework. Where other frameworks aim to bring React-style development to rust, Natrix embraces Rust’s strengths—leveraging smart pointers, derive macros, the builder pattern, and other idiomatic Rust features to create a truly native experience.
A simple counter in Natrix looks like this:
use natrix::prelude::*;
#[derive(Component)]
struct Counter(usize);
impl Component for Counter {
fn render() -> impl Element<Self> {
e::button()
.text(|ctx: R<Self>| *ctx.0)
.on::<events::Click>(|ctx: E<Self>, _| {
*ctx.0 += 1;
})
}
}
See the book for more information
useSignal
everywhere, state is directly tied to Rust’s type system.RefCell
per component instance, all other state is managed within the rust borrowing rules, which gives stronger guarantees of no panics as well as performance.