1
Fork 0

Conditional render of icon component

This commit is contained in:
Jake Howard 2016-01-07 18:53:24 +00:00
parent 956816c4c7
commit c6f883f88c

View file

@ -2,8 +2,14 @@ import React from 'react';
export default class Item extends React.Component { export default class Item extends React.Component {
render() { render() {
let icon;
if (this.props.icon) {
icon = (
<i className={'icon ' + this.props.icon}></i>
);
}
return ( return (
<li><a href={this.props.href}><i className={'icon ' + this.props.icon}></i> {this.props.children}</a></li> <li><a href={this.props.href}>{icon} {this.props.children}</a></li>
); );
} }
} }