Skip to content

Default values for route segments #2781

@AdrienPensart

Description

@AdrienPensart

Feature Request

I would like to write something like this : #[route("/?:muted=true&:start=10")]
there is many url-serde serializer/deserializer for this kind of usecase.

For now, I have to write this :

#[derive(Clone, Routable, Debug, PartialEq)]
enum Route {
    #[route("/?:muted&:start")]
    BoxingTimer {
        muted: bool,
        start: u64,
    },
}

#[component]
fn BoxingTimer(
    muted: bool,
    start: bool,
) -> Element {
    if start == 0 {
       start = 10
    }
    if muted {
        mute()
    }
}

thank you for this amazing project!

Metadata

Metadata

Assignees

Labels

routerRelated to the router implementation

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions