I am trying to add a custom button built by MUI to my project. I want to enable my button if 2 objects are not empty, otherwise the button remains disabled. I have written code that is working half correctly.
I want to only enable my button if 2 condition satisfies. But the button becomes enabled only when one condition meets the criteria. The ternary operation is not accepting the && condition.
How can I tackle this problem?
{Object.keys(userSelectDevicename).length === 0 && Object.keys(userSelectDevicecategory).length === 0 ? (
<>
{" "}
<WsButton type="submit" size="small" variant="contained" disabled={bool}>
Add
</WsButton>
</>
) : (
<>
{" "}
<WsButton type="submit" size="small" variant="contained" disabled={!bool}>
Add
</WsButton>
</>
)};