How to use length for 'For'?

Sometimes I want to just use loop's length, instead of each like js's for loop. Should I always provide array to use For? Can I do something like this picture?
4 Replies
Homercat
Homercat2y ago
<For each={new Array(10).fill(1)}>
{(_o, i) => <div>{i}</div>}
</For>
<For each={new Array(10).fill(1)}>
{(_o, i) => <div>{i}</div>}
</For>
musiclover
musiclover2y ago
Hmm well, that's what i'm doing already. I hope <For> allows just length...it will be very useful..
Homercat
Homercat2y ago
I don't think so, the users can extract an range(i) function to return an array, i think the syntax rules of solid should keep as little as possible.
Alex Lohr
Alex Lohr2y ago
GitHub
solid-primitives/packages/range at main · solidjs-community/solid-p...
A library of high-quality primitives that extend SolidJS reactivity. - solid-primitives/packages/range at main · solidjs-community/solid-primitives
Want results from more Discord servers?
Add your server