Refactoring: Stateless functional components

This commit is contained in:
2017-01-15 01:39:19 -08:00
parent 5926538f35
commit 01d5f986b1
8 changed files with 128 additions and 47 deletions

View File

@@ -1,17 +1,28 @@
var React = require('react');
var Nav = require('Nav');
var Main = React.createClass({
render: function () {
return (
<div>
<Nav/>
<h2>Main Component</h2>
{this.props.children}
</div>
// var Main = React.createClass({
// render: function () {
// return (
// <div>
// <Nav/>
// <h2>Main Component</h2>
// {this.props.children}
// </div>
//
// );
// }
// });
);
}
});
var Main = (props) => {
return (
<div>
<Nav/>
<h2>Main Component</h2>
{props.children}
</div>
);
};
module.exports = Main;