Crate dioxus_router

source ·
Expand description

Dioxus Native Core

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 a React-Router style interface using somewhat loose typing rules.

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

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.

Structs

Props for the Link component.
A route is a combination of window title, saved state, and a URL.
The props for the Router component.
A RouteContext is a context that is provided by Route components.
Props for the Route component.
The props for the Router component.
An abstraction over the platform’s history API.
A handle to the current location of the router.

Enums

An error specific to the Router

Functions

A component that renders a link to a route.
If this component is rendered, it will redirect the user to the given route.
A component that conditionally renders children based on the current location.
A component that conditionally renders children based on the current location of the app.
Get the router service from an existing VirtualDom.
This hook provides access to information about the current location in the context of a [Router]. If this function is called outside of a Router component it will panic.
This hook provides access to the RouterService for the app.

Type Definitions

A clonable handle to the router