From fa1e807496145b85d6588c24b219b0519f9ce5cf Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Fri, 26 Apr 2024 22:27:30 +0200 Subject: [PATCH] docs: fix mistakes in code examples for routing Fixes #616 --- .../advanced/content/20-understanding/40-routing.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md b/solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md index 8e5bc424b..9859ca142 100644 --- a/solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md +++ b/solara/website/pages/documentation/advanced/content/20-understanding/40-routing.md @@ -68,7 +68,7 @@ If you do define a `Page` component, you are fully responsible for how routing i An example route definition could be something like this: ```python -import solara as sol +import solara routes = [ # route level == 0 @@ -103,7 +103,7 @@ routes = [ @solara.component def Page(): level = solara.use_route_level() # returns 0 - route_current, routes_current_level = solara.use_routes() + route_current, routes_current_level = solara.use_route() # route_current is routes[1], i.e. solara.Route(path="docs", children=[...]) # routes_current_level is [routes[0], routes[1], routes[2], routes[3]], i.e.: # [solara.Route(path="/"), solara.Route(path="docs", children=[...]), @@ -125,7 +125,7 @@ Now the `MyFirstLevelChildComponent` component is responsible for rendering the @solara.component def MyFirstLevelChildComponent(): level = solara.use_route_level() # returns 1 - route_current, routes_current_level = solara.use_routes() + route_current, routes_current_level = solara.use_route() # route_current is routes[1].children[0], i.e. solara.Route(path="basics", children=[...]) # routes_current_level is [routes[1].children[0], routes[1].children[1]], i.e.: # [solara.Route(path="basics", children=[...]), solara.Route(path="advanced")] @@ -143,7 +143,7 @@ And the `MySecondLevelChildComponent` component is responsible for rendering the @solara.component def MySecondLevelChildComponent(): level = solara.use_route_level() # returns 2 - route_current, routes_current_level = solara.use_routes() + route_current, routes_current_level = solara.use_route() # route_current is routes[1].children[0].children[0], i.e. solara.Route(path="react") # routes_current_level is [routes[1].children[0].children[0], routes[1].children[0].children[1], routes[1].children[0].children[2]], i.e. # [solara.Route(path="react"), solara.Route(path="ipywidgets"), solara.Route(path="solara")]