You could define a ref, and then inside the object, make multiple subvalues based on the key of the child:
const ref = useRef({})
{array.map((item)=><div key={item.id} ref={ref.current[item.id] ??= { current: null }}>{item.id}</div>)}
Example: https://playcode.io/1096173
Another approach is callback refs: