Created
January 8, 2016 01:14
-
-
Save uxder/da92f762df422eb3ad49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
/** | |
* Main Application entry point. | |
*/ | |
class App extends Component { | |
render() { | |
var place = 'yo'; | |
return ( | |
<div> | |
<h1>Hello {place}</h1> | |
<h2>Grocery List</h2> | |
<GroceryList /> | |
</div> | |
) | |
} | |
} | |
/** | |
* Grocery List component. | |
*/ | |
class GroceryList extends Component { | |
render() { | |
return( | |
<ul> | |
<ListItem quantity="1" name="Bread" /> | |
<ListItem quantity="6" name="Eggs" /> | |
<ListItem quantity="2" name="milke" /> | |
</ul> | |
) | |
} | |
} | |
/** | |
* List item component. | |
*/ | |
class ListItem extends Component { | |
render() { | |
return ( | |
<li> | |
{this.props.quantity} x {this.props.name} | |
</li> | |
) | |
} | |
} | |
React.render(<App />, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment