I am trying to achieve something similar to this question How do I include a font awesome icon in my svg?
but I have 10 icons which has similar structure but only icon differs I have return a function to generate the Unicode character as
static renderIcon (status) {
if (status === 'RED') {
return ''
} else if (status === 'GREEN') {
return ''
} else if (status === YELLOW') {
return ''
}
}
static renderTextWithIcon = (obj) => {
return (
<text x={params.cx} y={params.cy}
className={ css.color}
>
{Utils.renderStatusIconContent(obj.status)}
</text>
)
}
But it renders the strings as '' if I try to give without quotes it accepts and shows the icon,but I have to repeat the same code for each color. How can I write a function which take the Unicode characters as parameters?