I am using a switch case to render text based on the case value. In addition to the text, I also want to add an icon. So for a particular case, there would be an icon and next to it there would be an appropriate text.
To implement that, I am adding icon and text in return statement of case condition.
case 'DENIED':
return <Square /> + intl.formatMessage(messages.processDenied);
case 'CANCELLED':
return <CloseIcon color='red' /> + intl.formatMessage(messages.processCancelled);
case 'INCOMPLETE':
return <HourglassIcon /> + intl.formatMessage(messages.processIncomplete);
default:
return intl.formatMessage(messages.processApproved);
}
When I use the above logic, I get
Instead of displaying icon, it displays [object,object]. Can I not use '+' sign to concatenate two elements ? If so, how do I return both the elements in a single return?