score:3

Accepted answer
import React, {PropTypes, Component} from 'react';

const menuData = require('./data/admin.menu.json');

function MenuItem({key, ref, title, icon, submenu}) {
  return (
    <div className={`item${key}`}>
      <a href={ref}>{title}<i className={`fa ${icon}`}/></a>
      if (submenu) {
        submenu.map((subitem) => <MenuItem {...subitem} />)
      }
    </div>
  );
}

MenuItem.propTypes = {
    key: PropTypes.string,
    title: PropTypes.string,
    ref: PropTypes.string,
    icon: PropTypes.string,
    submenu: PropTypes.array,
};

class SidebarMenu extends Component {
    constructor(props) {
        super(props);
        this.state = {
            expanded: true,
        };
    }

    render() {
        return (
            <div>
                {
                    menuData.map((subitem) => <MenuItem {...subitem} />)
                }
            </div>
        );
    }
}

export default SidebarMenu;

score:0

render() {
    let that = this
    return (

Related Query

More Query from same tag