Skip to content

Commit bd63f48

Browse files
committed
Add Key to component types
1 parent 783075f commit bd63f48

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/reactpy_router/components.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from reactpy import component, html, use_connection
99
from reactpy.backend.types import Location
1010
from reactpy.core.component import Component
11-
from reactpy.core.types import VdomDict
11+
from reactpy.core.types import Key, VdomDict
1212
from reactpy.web.module import export, module_from_file
1313

1414
from reactpy_router.hooks import _use_route_state
@@ -40,7 +40,7 @@
4040
link_js_content = (Path(__file__).parent / "static" / "link.js").read_text(encoding="utf-8")
4141

4242

43-
def link(attributes: dict[str, Any], *children: Any) -> Component:
43+
def link(attributes: dict[str, Any], *children: Any, key: Key | None = None) -> Component:
4444
"""
4545
Create a link with the given attributes and children.
4646
@@ -51,7 +51,7 @@ def link(attributes: dict[str, Any], *children: Any) -> Component:
5151
Returns:
5252
A link component with the specified attributes and children.
5353
"""
54-
return _link(attributes, *children)
54+
return _link(attributes, *children, key=key)
5555

5656

5757
@component
@@ -132,7 +132,7 @@ def route(path: str, element: Any | None, *routes: Route) -> Route:
132132
return Route(path, element, routes)
133133

134134

135-
def navigate(to: str, replace: bool = False) -> Component:
135+
def navigate(to: str, replace: bool = False, key: Key | None = None) -> Component:
136136
"""
137137
Navigate to a specified URL.
138138
@@ -146,7 +146,7 @@ def navigate(to: str, replace: bool = False) -> Component:
146146
Returns:
147147
The component responsible for navigation.
148148
"""
149-
return _navigate(to, replace)
149+
return _navigate(to, replace, key=key)
150150

151151

152152
@component

0 commit comments

Comments
 (0)