Skip to content

Commit e644a35

Browse files
add dispatcher example
1 parent c20ea46 commit e644a35

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ async function* List() {
124124
export default Coroutine.create(List);
125125
```
126126

127+
Async iterators allow you to yield new UI pieces over the time, without the need to re-render a component by parent element.
128+
129+
```javascript
130+
async function* EventStreamContainer() {
131+
for await (const message of dispatcher) {
132+
yield <p>Last message {message.type}</p>;
133+
}
134+
}
135+
136+
export default Coroutine.create(EventStreamContainer);
137+
```
138+
127139
## Testing
128140

129141
Please read the [testing guide](./Testing.md).

0 commit comments

Comments
 (0)