Skip to content

Commit e3a1e76

Browse files
committed
Add fragment syntax back to README
1 parent b17a554 commit e3a1e76

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,21 @@ result = html(t"<ul><{Items} /></ul>")
385385
assert str(result) == "<ul><li>first</li><li>second</li></ul>"
386386
```
387387

388+
If you prefer, you can use **explicit fragment syntax** to wrap multiple
389+
390+
391+
elements in a `Fragment`:
392+
393+
```python
394+
def Items() -> Node:
395+
return html(t'<><li>first</li><li>second</li></>')
396+
397+
result = html(t'<ul><{Items} /></ul>')
398+
assert str(result) == "<ul><li>first</li><li>second</li></ul>"
399+
```
400+
401+
This is not required, but it can make your intent clearer.
402+
388403
#### Class-based components
389404

390405
Component functions are great for simple use cases, but for more complex

0 commit comments

Comments
 (0)