Denis Richartz b71cf6ed4a cargo fmt 3 years ago
..
.vscode cb2782b4bb wip: memoize dom in the prescence of identical components 3 years ago
examples 4a3680ee1b chore: remove all warnings 3 years ago
src b71cf6ed4a cargo fmt 3 years ago
tests f1865faef7 setup done, local tests work, check workflow 3 years ago
CHANGELOG.md 56f3002aed feat: add changelogs 3 years ago
Cargo.toml ee49fc27ff fix some newlines 3 years ago
Makefile.toml bd565bb65f improve Makefile tests 3 years ago
README.md 29ed7ebece feat: connect an onchange listener 3 years ago
webdriver.json ee49fc27ff fix some newlines 3 years ago

README.md

Routing for Dioxus App

DioxusRouter adds React-Router style routing to your Dioxus apps. Works in browser, SSR, and natively.

fn app() {
    cx.render(rsx! {
        Router {
            Route { to: "/", Component {} },
            Route { to: "/blog", Blog {} },
            Route { to: "/blog/:id", BlogPost {} },
        }
    })
}

Then, in your route, you can choose to parse the Route any way you want through use_route.

let id: usize = use_route(&cx).segment("id")?;

let state: CustomState = use_route(&cx).parse()?;

Adding links into your app:

Link { to: "id/{id}" }

Currently, the router is only supported in a web environment, but we plan to add 1st-party support via the context API when new renderers are available.