You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Third argument of the map function is an index signal.
179
180
180
-
`MapEntries` is using [`Map#key()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys) so the index and resulting JSX will follow the insertion order.
181
+
`MapEntries` is using [`Map#keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys) so the index and resulting JSX will follow the insertion order.
@@ -189,6 +190,42 @@ Third argument of the map function is an index signal.
189
190
</MapEntries>
190
191
```
191
192
193
+
## `<SetValues>`
194
+
195
+
Creates a list of elements by mapping Set values. Similar to Solid's `<For>` and `<Index>`, but here, render function takes two arguments, the value and the index argument as a signal.
196
+
197
+
### How to use it
198
+
199
+
```tsx
200
+
import {SetValues} from "@solid-primitives/keyed";
Second argument of the map function is an index signal.
216
+
217
+
`SetValues` is using [`Set#values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/values) so the index and resulting JSX will follow the insertion order.
Copy file name to clipboardExpand all lines: packages/keyed/src/index.ts
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,37 @@ export function MapEntries<K, V>(props: {
239
239
)asunknownasJSX.Element;
240
240
}
241
241
242
+
/**
243
+
* Creates a list of elements from the values of provided Set
244
+
*
245
+
* @param props
246
+
* @param props.of set to iterate values of (`mySet.values()`)
247
+
* @param props.children
248
+
* a map render function that receives a Set value and **index signal** and returns a JSX-Element; if the list is empty, an optional fallback is returned:
0 commit comments