Need your help with regards to enabling button when click INSIDE .map
Here's the data from backend:
file :[
{
id: 1
color: orange,
shape: triangle
}
{
id: 2
color: blue,
shape: circle
}
{
id: 3
color: red,
shape: rectangle
}
]
And this is the file rendered in .map way:
{file.map(file => ( `<div>
<a
onClick={() => this.downloadFile(file)}
href="javascript:void(0);"
>
{file.fileName}
</a>
</div>
<Button
onClick={() => this.submit()}
disabled={should be enabled when click}
>
submit
</Button>
))}
In UI, it looks like this:
LINK--------------Button (this is disabled)
LINK--------------Button (this is disabled)
LINK--------------Button (this is disabled)
What i need is a function that when i click the first LINK, it only enable the first button beside it, what i have now is when i click the first LINK, it enables all the button
Please help. Thanks