Last active
February 4, 2019 11:25
-
-
Save avillegasn/26681342e7c4f17936c29248177125bb to your computer and use it in GitHub Desktop.
React UI with JSX syntax.
This file contains hidden or 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
class Product extends Component { | |
render() { | |
return wp.element.createElement( | |
"div", | |
{ className: "product" }, | |
wp.element.createElement( | |
"p", | |
null, | |
this.props.name | |
) | |
); | |
} | |
} | |
class ShoppingList extends Component { | |
render() { | |
return wp.element.createElement( | |
"div", | |
{ className: "shopping-list" }, | |
wp.element.createElement( | |
"h1", | |
null, | |
"Shopping List for ", | |
this.props.name | |
), | |
wp.element.createElement( | |
"ul", | |
null, | |
wp.element.createElement(Product, { name: "Carrot" }), | |
wp.element.createElement(Product, { name: "Tomato" }), | |
wp.element.createElement(Product, { name: "Potato" }) | |
) | |
); | |
} | |
} |
This file contains hidden or 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
class Product extends Component { | |
render() { | |
return ( | |
<div className="product"> | |
<p>{this.props.name}</p> | |
</div> | |
); | |
} | |
} | |
class ShoppingList extends Component { | |
render() { | |
return ( | |
<div className="shopping-list"> | |
<h1>Shopping List for {this.props.name}</h1> | |
<ul> | |
<Product name="Carrot"/> | |
<Product name="Tomato"/> | |
<Product name="Potato"/> | |
</ul> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment