hi guys i try to make onclick inside map looping , so the onclick inside the div , but i got error , infinite looping
here the code
{arrayqueue.map((item, index) => {
return (
<div className="row-queue" key={index} onClick={setMyvideo(item.videoname)}>
<div className="column1-queue">{index + 1}</div>
<div className="column2-queue">{item.title}</div>
<div className="column3-queue">{item.singer}</div>
</div>
);
})}
can someone help me why this is error ?
setMyVideo, not a function call directly. So it should beonClick={() => setMyvideo(item.videoname)}setMyVideodefinition if this doesn't fix it to help clarify things. And include the specifics of your error message, it's exact text, where in the code it's happening, etc.