Let say I have a list of icons which should be shown on the page when data from api comes. It can be for example divs or svg other html code. Just for example it is img.
function Icon1() {
return <img src="/link/to/image1.jpg" />
}
function Icon2() {
return <img src="/link/to/image2.jpg" />
}
class IconLoader extends Component {
render() {
let image = 'Icon' + this.props.image;
return <{image} />;
}
}
Than i want something like this:
function Some() {
return <div><IconLoader image="1" /><IconLoader image="2" /></div>
}
All my tries comes to fail React produce error:
The tag <Icon1> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter
or just print tagname instead of rendering it...
Solution like "put all your components into array" unacceptable according to count of that icons