Skip to content

Commit 7e831cf

Browse files
committed
docs(kida): fix 'for' example
1 parent 47d0121 commit 7e831cf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/kida/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,14 @@ export const $admins = computed(get => get($users).filter(user => user.isAdmin))
5353

5454
```tsx
5555
// components/admins.ts
56-
import { atIndex, record } from 'kida'
56+
import { record } from 'kida'
5757
import { $admins } from '../stores/admins.js'
5858

5959
export function Admins() {
6060
return ul()(
61-
for$($admins)((i) => {
62-
const $admin = record(atIndex($admins, i))
63-
64-
return li()($admin.name)
65-
})
61+
for$($admins, user => user.id)(
62+
$admin => li()(record($admin).name)
63+
)
6664
)
6765
}
6866
```
@@ -110,7 +108,7 @@ $count.set($count.get() + 1)
110108
update($count, count => count + 1)
111109
```
112110

113-
To listen to changes, use the `listen` or `subscribe` function. `subscribe` will call the listener immediately.
111+
To listen changes, use the `listen` or `subscribe` function. `subscribe` will call the listener immediately.
114112

115113
```ts
116114
import { signal, subscribe } from 'kida'

0 commit comments

Comments
 (0)