React Base Fiddle (JSX)

Starting point for creating JSFiddles with React.

HTML

<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="container">
    <!-- This element's contents will be replaced with your component. -->
</div>

CSS

.menu {
  list-style: none;
  margin: 0;
  padding: 0 10px;
}

.menu ul {
  border-left: dotted;
  border-width: 1px;
}

Babel + JSX

class Menu extends React.Component{
	constructor(props){
  	super(props);
    this.state = {
    	open: false
    }
    
    this.toggleDropDown = this.toggleDropDown.bind(this);
  }
  
  toggleDropDown(){
  	// this toggles the open state of the menu
    this.setState({open: !this.state.open})
  }
  
  render(){
  	// only display children if open is true
  	return(
    	<ul className="menu">
        <li onClick={this.toggleDropDown}>         {this.props.title}  </li>
        {(this.state.open)?this.props.children:null}
    	</ul>
    )
  }
}

class Hello extends React.Component {
  render() {
    return (
    <div>
      <Menu title="one">
        <Menu title="Alpha">
          <ul>
            <li>Hello</li>
            <li>World</li>
          </ul>
        </Menu>
        <Menu title="Beta">
          <ul>
            <li>Hello</li>
            <li>World</li>
          </ul>
        </Menu>
      </Menu>  
      <Menu title="two">
      <ul>
        <li>Alpha</li>
        <li>Beta</li>
        </ul>
      </Menu>
      <ul className="menu">
      <li>three</li>
      <li>four</li>
      </ul>
    </div>
    );
  }
}

ReactDOM.render(
  <Hello name="World" />,
  document.getElementById('container')
);