Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Introducing Momenta: JSX-like for Rust
TL;DR: Lightweight JSX-like syntax for Rust with signals and components.
I started Momenta while porting my portfolio from Next.js to Rust. Momenta provides JSX familiarity + Rust type safety + composable primitives without hook complexity. Good for SSR, static sites, or clean HTML generation.
{when!(show => <p>Hello</p> else <p>Hidden</p>)}
<></>
use momenta::prelude::*;
let count = 42;
let items = &["Item 1", "Item 2", "Item 3"];
let html = rsx!(
<html>
<body>
<div class="container">
<h1>Count: {count}</h1>
{when!(count > 10 =>
<p>That's a lot!</p>
else
<p>Just getting started</p>
)}
<ul>
{items.iter().map(|item| rsx!(<li>{item}</li>))}
</ul>
</div>
</body>
</html>
);
println!("{}", html.to_string()); // works fine on server side
Links:
[dependencies]
momenta = "0.2"
I would really appreciate any and all feedbacks too.
Thanks!
1 post - 1 participant
🏷️ Rust_feed