I am adding conditions to display a div element and condition has a variable which comes to be 0 and when it is 0 then 0 displays instead of not displaying anything.
using functional component:
return (
<div>
{flag1 && flag2 && data1 && data1.length && data2 && data2.length && (
<div className="answers-heading">Answers ({data2.length})</div>
)}
</div>
);
In the above code, I expect if any of the variables are not true then it should simply not display div element but I am getting 0 in UI. When all conditions true then it works fine. I have created stackblitz demo to show how it is working in an unexpected manner.
Any help would be appreciated.
Already spent a whole day debugging but could not find the reason.