Skip to content

Instantly share code, notes, and snippets.

@ryanjyost
Last active January 22, 2017 21:10
Show Gist options
  • Select an option

  • Save ryanjyost/e69e0544caa16b03a36aa9451c2406e8 to your computer and use it in GitHub Desktop.

Select an option

Save ryanjyost/e69e0544caa16b03a36aa9451c2406e8 to your computer and use it in GitHub Desktop.
rainy-day-fund/src/components/AssumptionsContainer.js
//src/components/AssumptionsContainer
import { connect } from 'react-redux';
import { updateIncomeSources, updateIncome, updateSavings } from '../actions'
import Assumptions from './Assumptions'
const mapStateToProps = (state) => {
return {
assumptions: state.assumptions,
}
}
const mapDispatchToProps = (dispatch) => {
return {
handleUpdateIncomeSources: (sources) => {
dispatch(updateIncomeSources(Number(sources)))
},
handleUpdateIncome: (income) => {
dispatch(updateIncome(
Number((income).replace(",",""))
))
},
handleUpdateSavings: (savings) => {
dispatch(updateSavings(
Number((savings).replace(",", ""))
))
}
}
}
const AssumptionsContainer = connect(
mapStateToProps,
mapDispatchToProps
)(Assumptions)
export default AssumptionsContainer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment