Issue
array.map((el,i) =>{
return(
<Dropzone
ref = {ref1}
/>
)
})
the question is it only ref to the last rendered Dropzone, how can I use ref through loop on all Dropzone component which is render in loop
Solution
try:
const refs = useRef([]);
array.map((el,i) =>{
refs.current[i] = createRef();
return(
<Dropzone
ref={refs.current[i]}
/>
)
})
Answered By - Hesam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.