in the docs it is described to use a signal, to get the ref of an element, for example:
const mySignal = useSignal(0);
<article ref={myRef} />
but i am rendering several elements from an array, and wanted to get the reference of each element. how would i go about it, with the correct typing?
i tried using useStore and the key being the ID of the element. i have passed the ref down to the native element, but i get the following error:
Type 'HTMLDialogElement' is not assignable to type 'Ref<T> | undefined'.ts(2322)
jsx-runtime.d.ts(1367, 5): The expected type comes from property 'ref' which is declared here on type 'DialogHTMLAttributes<HTMLDialogElement>'
and here it is being assigned:
const dialogRefs = useStore<DialogRefs>({});
<TalkModal
{...usableData}
ref={(el) => {
if (el) {
dialogRefs[talk.id] = el;
}
}}
/>
which is incorrect.