Skip to content

Commit

Permalink
cleaned up PropTypes validations - react-router-redux throwing PropTy…
Browse files Browse the repository at this point in the history
…pes error.
  • Loading branch information
TobiahRex committed Aug 31, 2017
1 parent 251fba8 commit 3efc625
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable import/no-named-as-default */

import React from 'react';
import PropTypes from 'prop-types';
import { Route } from 'react-router';
Expand Down
31 changes: 23 additions & 8 deletions src/components/FuelSavingsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ class FuelSavingsForm extends React.Component {
<td><label htmlFor="milesDriven">Miles Driven</label></td>
<td>
<FuelSavingsTextInput
onChange={this.fuelSavingsKeypress}
name="milesDriven"
value={fuelSavings.milesDriven}/>
onChange={this.fuelSavingsKeypress}
name="milesDriven"
value={fuelSavings.milesDriven}/>
miles per
<select
name="milesDrivenTimeframe"
onChange={this.onTimeframeChange}
value={fuelSavings.milesDrivenTimeframe}>
name="milesDrivenTimeframe"
onChange={this.onTimeframeChange}
value={fuelSavings.milesDrivenTimeframe}>
<option value="week">Week</option>
<option value="month">Month</option>
<option value="year">Year</option>
Expand All @@ -85,12 +85,27 @@ class FuelSavingsForm extends React.Component {
);
}
}
const { func, object } = PropTypes;
const { func, shape, number, bool, string } = PropTypes;

FuelSavingsForm.propTypes = {
saveFuelSavings: func.isRequired,
calculateFuelSavings: func.isRequired,
fuelSavings: object.isRequired
fuelSavings: shape({
newMpg: number,
tradeMpg: number,
newPpg: number,
tradePpg: number,
milesDriven: number,
milesDrivenTimeframe: string,
displayResult: bool,
dateModified: string,
necessaryDataIsProvidedToCalculateSavings: bool,
savings: shape({
monthly: number,
annual: number,
threeYear: number,
}),
}).isRequired
};

export default FuelSavingsForm;
1 change: 0 additions & 1 deletion src/components/Root.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { ConnectedRouter } from 'react-router-redux';
console.log('%cConnectedRouter', 'background:red;', ConnectedRouter);
import { Provider } from 'react-redux';
import App from './App';

Expand Down

0 comments on commit 3efc625

Please sign in to comment.