8
8
from reactpy import component , html , use_connection
9
9
from reactpy .backend .types import Location
10
10
from reactpy .core .component import Component
11
- from reactpy .core .types import VdomDict
11
+ from reactpy .core .types import Key , VdomDict
12
12
from reactpy .web .module import export , module_from_file
13
13
14
14
from reactpy_router .hooks import _use_route_state
40
40
link_js_content = (Path (__file__ ).parent / "static" / "link.js" ).read_text (encoding = "utf-8" )
41
41
42
42
43
- def link (attributes : dict [str , Any ], * children : Any ) -> Component :
43
+ def link (attributes : dict [str , Any ], * children : Any , key : Key | None = None ) -> Component :
44
44
"""
45
45
Create a link with the given attributes and children.
46
46
@@ -51,7 +51,7 @@ def link(attributes: dict[str, Any], *children: Any) -> Component:
51
51
Returns:
52
52
A link component with the specified attributes and children.
53
53
"""
54
- return _link (attributes , * children )
54
+ return _link (attributes , * children , key = key )
55
55
56
56
57
57
@component
@@ -132,7 +132,7 @@ def route(path: str, element: Any | None, *routes: Route) -> Route:
132
132
return Route (path , element , routes )
133
133
134
134
135
- def navigate (to : str , replace : bool = False ) -> Component :
135
+ def navigate (to : str , replace : bool = False , key : Key | None = None ) -> Component :
136
136
"""
137
137
Navigate to a specified URL.
138
138
@@ -146,7 +146,7 @@ def navigate(to: str, replace: bool = False) -> Component:
146
146
Returns:
147
147
The component responsible for navigation.
148
148
"""
149
- return _navigate (to , replace )
149
+ return _navigate (to , replace , key = key )
150
150
151
151
152
152
@component
0 commit comments