
Leptos Has a Free API That Builds Full-Stack Web Apps in Rust With Fine-Grained Reactivity
Leptos is a Rust framework for building web apps. Compiles to WebAssembly for the client, native Rust for the server. Fine-grained reactivity like SolidJS, but in Rust. Quick Start cargo install cargo-leptos cargo leptos new --git leptos-rs/start cd my-app && cargo leptos watch Components use leptos :: * ; #[component] fn Counter () -> impl IntoView { let ( count , set_count ) = create_signal ( 0 ); view! { < button on : click = move | _ | set_count .update (| n | * n += 1 ) > "Count: " { count } </ button > } } Server Functions #[server(GetPosts)] pub async fn get_posts () -> Result < Vec < Post > , ServerFnError > { let posts = db :: get_all_posts () .await ? ; Ok ( posts ) } #[component] fn PostList () -> impl IntoView { let posts = create_resource (|| (), | _ | get_posts ()); view! { < Suspense fallback = move || view! { < p > "Loading..." </ p > } > { move || posts .get () .map (| data | view! { < For each = move || data .clone () key = | p | p .id let : post > < p > { post .title
Continue reading on Dev.to Webdev
Opens in a new tab

