Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline committed Jan 18, 2016
1 parent e409c61 commit 7f6cae3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/FuelSavingsResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import NumberFormatter from '../businessLogic/numberFormatter';
//More info: https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#stateless-functional-components
//And https://medium.com/@joshblack/stateless-components-in-react-0-14-f9798f8b992d
//And starter kit with more examples here: https://github.com/ericelliott/react-pure-component-starter
let FuelSavingsResults = (props) => {
let savingsExist = NumberFormatter.scrubFormatting(props.savings.monthly) > 0;
let savingsClass = savingsExist ? 'savings' : 'loss';
let resultLabel = savingsExist ? 'Savings' : 'Loss';
const FuelSavingsResults = (props) => {
const savingsExist = NumberFormatter.scrubFormatting(props.savings.monthly) > 0;
const savingsClass = savingsExist ? 'savings' : 'loss';
const resultLabel = savingsExist ? 'Savings' : 'Loss';

//You can even exclude the return statement below if the entire component is
//composed within the parenthesies. Return is necessary here because some
//composed within the parenthesies. Return is necessary here because some
//variables are set above.
return (
<table>
Expand Down Expand Up @@ -40,10 +40,10 @@ let FuelSavingsResults = (props) => {
);
};

//Note that this odd style is utilized for propType validation for now. Must be defined *after*
//Note that this odd style is utilized for propType validation for now. Must be defined *after*
//the component is defined, which is why it's separate and down here.
FuelSavingsResults.propTypes = {
savings: PropTypes.object.isRequired
};

export default FuelSavingsResults;
export default FuelSavingsResults;

0 comments on commit 7f6cae3

Please sign in to comment.