Skip to content

Commit 4d38e5f

Browse files
authored
var operation incompete foreach example (#1214)
1 parent 3e43199 commit 4d38e5f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/vars/var-operations.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,14 @@ def get_badge(technology: str) -> rx.Component:
428428
return rx.badge(technology, variant="soft", color_scheme="green")
429429

430430
def project_item(project: dict):
431-
432431
return rx.box(
433432
rx.hstack(
434433
rx.foreach(project["technologies"], get_badge)
435434
),
436435
)
436+
437+
def failing_projects_example() -> rx.Component:
438+
return rx.box(rx.foreach(ProjectsState.projects, project_item))
437439
```
438440

439441
The code above throws the error `TypeError: Could not foreach over var of type Any. (If you are trying to foreach over a state var, add a type annotation to the var.)`

0 commit comments

Comments
 (0)