Evan Almloff d3b21879fb create non generic wrappers for each route 2 anos atrás
..
examples d3b21879fb create non generic wrappers for each route 2 anos atrás
src d3b21879fb create non generic wrappers for each route 2 anos atrás
tests 90c7e22f8b actually make clippy happy 2 anos atrás
.gitignore e04a6d63a5 chore: move tests out of core and into the top level crate 3 anos atrás
CHANGELOG.md 56f3002aed feat: add changelogs 3 anos atrás
Cargo.toml 7ae8403af7 update web history 2 anos atrás
Makefile.toml bd565bb65f improve Makefile tests 3 anos atrás
README.md 231e32d76e merge upstream changes 2 anos atrás
webdriver.json ee49fc27ff fix some newlines 3 anos atrás

README.md

Dioxus Router

Crates.io MIT licensed Build Status Discord chat

Website | Guides | API Docs | Chat

Overview

Dioxus Router is a first-party Router for all your Dioxus Apps. It provides an interface similar to React Router, but takes advantage of types for more expressiveness.

use dioxus::prelude::*;
use dioxus_router::prelude::*;

fn App(cx: Scope) -> Element {
    use_router(
        &cx,
        &|| Default::default(),
        &|| Segment::content(comp(Index)).fixed(
            "blog",
            Route::content(comp(Blog)).nested(
                Segment::content(comp(BlogList))
                    .catch_all((comp(BlogPost), BlogPost))
            )
        )
    );

    render! {
        Outlet { }
    }
}

fn Index(cx: Scope) -> Element {
    render! {
        h1 { "Index" }
        Link {
            target: "/blog",
            "Go to the blog"
        }
    }
}

fn Blog(cx: Scope) -> Element {
    render! {
        h1 { "Blog" }
        Outlet { }
    }
}

fn BlogList(cx: Scope) -> Element {
    render! {
        h2 { "List of blog posts" }
        Link {
            target: "/blog/1",
            "Blog post 1"
        }
        Link {
            target: "/blog/1",
            "Blog post 2"
        }
    }
}

fn BlogPost(cx: Scope) -> Element {
    render! {
        h2 { "Blog Post" }
    }
}

You need to enable the right features for the platform you're targeting since these are not determined automatically!

Contributing

  • Report issues on our issue tracker.
  • Join the discord and ask questions!

License

This project is licensed under the MIT license.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Dioxus by you shall be licensed as MIT without any additional terms or conditions.