By example, have a list component when each item have a custom icon component and set it on properties. But, how to add a class name to object into the variable?:
const items = [
{ name: "Example", icon: <Foo /> }
];
return (
<ListItems items={items} />
)
Now, from ListItems
components, how to add a classname to icon object?
return (
<div>
{items.map((prop, key) => {
{prop.icon}
<span>{prop.name}</span>
})}
</div>
);
The ListItem is a component with own style, but need add classname to icon object, by example:
<[prop.icon] className={classes.foo} />
(but <[prop.icon] />
is a invalid syntax).