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,27 @@
var React = require('react');
var {Link, IndexLink} = require('react-router');
var Nav = React.createClass({
render: function (){
return (
<div>
<h2>Nav Component</h2>
<IndexLink to="/" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> Get Weather</IndexLink>
<Link to="/about" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> About</Link>
<Link to="/examples" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> Examples</Link>
</div>
);
}
});
// var Nav = React.createClass({
// render: function (){
// return (
// <div>
// <h2>Nav Component</h2>
// <IndexLink to="/" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> Get Weather</IndexLink>
// <Link to="/about" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> About</Link>
// <Link to="/examples" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> Examples</Link>
// </div>
// );
// }
// });
var Nav = () => {
return (
<div>
<h2>Nav Component</h2>
<IndexLink to="/" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> Get Weather</IndexLink>
<Link to="/about" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> About</Link>
<Link to="/examples" activeClassName="active" activeStyle={{fontWeight: 'bold'}}> Examples</Link>
</div>
);
};
module.exports = Nav;