Using refs in list rendering
Is there any way to use refs in list rendering? In a <For> or <Index>, I'd like to have an array of refs, or generally a way to retrieve ref to an element in the list by index. I can't find any mention of it in the docs, and given that ref takes a variable or signal, I don't see how to assign a specific array key rather than a hardcoded variable.
4 Replies
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Slap the ref on the parent and use good old DOM properties like children
You can also pass in any function to
ref
to e.g. put the ref into an array: https://playground.solidjs.com/anonymous/6daa88f6-7681-4e98-89c8-aaf3885383ec