Problem
Several documentation pages show navigation code that doesn't run against the real API:
- docs/getting-started.md (~lines 48 and 56-57): the example calls route.params.get('count', 0), but use_route() returns the params dict directly (see use_route() in src/pythonnative/navigation.py, line 920). It also calls Stack.Screen("Home", HomeScreen, ...) positionally, but Screen requires the keyword-only argument component= (see src/pythonnative/navigation.py, lines 532, 670, and 840).
- docs/guides/navigation.md (~lines 35-36, 63-64, and 178-179): the same positional Stack.Screen(...) calls.
- docs/examples/navigation.md (~line 41): uses route['params']['user_id'], but use_route() already returns the params dict, so this should be route['user_id'] (or route.get('user_id')). Lines 58-59 also recommend nav.replace(...), which doesn't exist; navigators expose navigate, go_back, and reset only.
Suggested fix
Update the snippets to match the real API, for example:
params = pn.use_route()
count = params.get("count", 0)
Stack.Screen("Home", component=HomeScreen, options={"title": "Home"})
and replace the nav.replace(...) mention with nav.reset(...).
docs/examples/navigation.md lines 51-52 already show the correct keyword form, so it's a good reference.
Verification
Run mkdocs build --strict and, ideally, paste the corrected getting-started example into a pn init project to confirm it runs.
Suggested commit message
docs(navigation): fix use_route and Stack.Screen examples
Reactions are currently unavailable
Problem
Several documentation pages show navigation code that doesn't run against the real API:
Suggested fix
Update the snippets to match the real API, for example:
and replace the nav.replace(...) mention with nav.reset(...).
docs/examples/navigation.md lines 51-52 already show the correct keyword form, so it's a good reference.
Verification
Run mkdocs build --strict and, ideally, paste the corrected getting-started example into a pn init project to confirm it runs.
Suggested commit message