I have a quick question . I am trying to disable a button conditionally. Basically if something is selected from my table then i allow the button to be available otherwise it is disabled . I know that MUI expects a boolean in order to disable or enable the button so from my array i am doing a forEach loop and get the value of the selected . But it seems that nothing happens even thought if i have the value of the selected . Any ideas what am i doing wrong ?
My array :
data: [{
....
selected : true / false
....
}]
My button:
<Tooltip title='Download'>
<Button
className={classes.root}
key='DownloadAll'
disabled={data.forEach(element => element.selected)}
color='primary'
onClick={(event) => buttonOnClick()}
>
<SvgIcon
component={faDownload}
/>
</Button>
</Tooltip>