Let's say I have icons:
//myicons.js
import React from "react";
export const ico = {
someIcon:
<svg ... >
...
</svg>,
And a component that uses some icon:
import React, { Component } from "react";
import { ico } from "./myicons";
export class MyIcon extends Component {
render () {
return ico[this.props.which];
}
}
And somewhere that uses the icon:
//some render func
return (
<div ... >
<MyIcon which="someIcon"/>
...
</div>
);
Suppose I were to add a css class:
<MyIcon which="someIcon" className="blahblah" />
..how do I get the DOM to end up containing <svg class="blahblah" i.e. how do I add the blahblah class given in <MyIcon className="blahblah" to the class= attribute of the <svg returned by ico[this.props.which] ?
If it helps, this is what ends up being returned from the render:
