Skip to content

Cannot reproduce routing examples from documentation, get an error #980

@tdard

Description

@tdard

Hi, I was trying to reproduce the examples given in here and I obtain the following error: Page not found: /, route does not link to a (markdown) path or module or component

It seems that using a route without a component is not supported. Is that true ? I read all the unit tests in relation to routing and no one tests the use case where the Route(path"/") does not have a component.

Here is the code that I wrote:

import solara

routes = [
    solara.Route(path="/"),
    solara.Route(path="kiwi"),
    solara.Route(path="banana"),
    solara.Route(path="apple"),
]


@solara.component
def Page():
    route_current, routes = solara.use_route()

    solara.Markdown("*Click on one of the links below to change the route and see the url in your browser change, and match the route.*")
    with solara.VBox():
        for route in routes:
            with solara.Link(route):
                current = route_current is route
                if current:
                    solara.Success(f"You are at solara.Route(path={route.path!r})")
                else:
                    solara.Info(f"Go to solara.Route(path={route.path!r})")

I use solara 1.41.0 on MacOS.

Thank you by advance,

T.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions