Skip to content

Commit

Permalink
Cleaned up mapStateToProps function
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamZarger committed Aug 11, 2017
1 parent e722dbf commit 7482dc3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Filters/SingleCheckbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ SingleCheckbox.defaultProps = {
isChecked: false
}

export const mapStateToProps = state => ( {
isChecked: typeof state.query.has_narrative !== 'undefined' &&
( state.query.has_narrative.toString() === 'yes' ||
state.query.has_narrative.toString() === 'true' )
} )
export const mapStateToProps = state => {
var queryValue = state.query.has_narrative
return {
isChecked: typeof queryValue !== 'undefined' &&
( queryValue.toString() === 'yes' ||
queryValue.toString() === 'true' )
}
}

export const mapDispatchToProps = dispatch => ( {
changeFlagFilter: ( fieldName, isChecked ) => {
Expand Down

0 comments on commit 7482dc3

Please sign in to comment.