As rightly commented by @Konrad Linkowski
This is invalid syntax
What is the issue with it?
What you are using is called expression. So condition1 && condition2 will return false if condition1 is falsey or will return condition2.
In your expression, its condition1 && condition2 condition3. There needs to be an operator between condition2 and condition3 or they need correct structure.
If you want label to always render and icon for "new" buttons, it should be:
{condition1 && condition2}
{condition3}
but if you need them to render together or none, you need to wrap then so that your expression returns 1 value:
{
condition1 &&
(<>
element1
element2
</>)
}
Sample
const ModalButton1 = ({ label, mode }) => {
return (
<button type="submit">
{
mode == "new" && (
<FaPlusCircle style={{ fontSize: "20px", paddingTop: "6px" }} />)
}
{ label }
</button>
);
};
const ModalButton2 = ({ label, mode }) => {
return (
<button type="submit">
{
mode == "new" && (
<>
<FaPlusCircle style={{ fontSize: "20px", paddingTop: "6px" }} />)
{label}
</>
}
</button>
);
};
labelcontains?