WASM with Leptos

Rust-powered WebAssembly application

WASM Demo

Example Code


// Cargo.toml
[dependencies]
leptos = "0.3"
wasm-bindgen = "0.2"

// lib.rs
use leptos::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

#[component]
pub fn App() -> impl IntoView {
    let (name, set_name) = create_signal("World".to_string());
    
    view! {
        <input
            type="text"
            on:input=move |ev| set_name(event_target_value(&ev))
            placeholder="Your name"
        />
        <p>"Hello, " {name}!</p>
    }
}
                

Build with Rust + WASM + Leptos