Last active
January 22, 2017 21:27
-
-
Save ryanjyost/4275f3b4fdca29b655fa742235f9cc97 to your computer and use it in GitHub Desktop.
rainy-day-fund/src/components/ExpensesContainer.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //src/components/ExpensesContainer | |
| import Expenses from './Expenses' | |
| import { connect } from 'react-redux'; | |
| import {addExpense, removeExpense, updateExpenseName, updateExpenseAmount} from '../actions' | |
| const mapStateToProps = (state) => { | |
| return { | |
| expenses: state.expenses, | |
| } | |
| } | |
| const mapDispatchToProps = (dispatch) => { | |
| return { | |
| handleAddExpense: (id) => { | |
| dispatch(addExpense(id)) | |
| }, | |
| handleRemoveExpense: (id) => { | |
| dispatch(removeExpense(id)) | |
| }, | |
| handleUpdateExpenseName: (id, newName) => { | |
| dispatch(updateExpenseName(id, newName)) | |
| }, | |
| handleUpdateExpenseAmount: (id, newAmount) => { | |
| dispatch(updateExpenseAmount(id, newAmount)) | |
| }, | |
| } | |
| } | |
| const ExpensesContainer = connect( | |
| mapStateToProps, | |
| mapDispatchToProps | |
| )(Expenses) | |
| export default ExpensesContainer | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment